From 74d2100dadad2624b4e2f891bb28a5d33ad1b61e Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 5 Apr 2019 15:22:00 +0800 Subject: [PATCH 1/2] Add blog unit tests. --- modules/blogging/Volo.Blogging.sln | 15 +++- .../Blogging/Tagging/MongoTagRepository.cs | 1 + .../Comments/CommentRepository_Tests.cs | 12 +++ .../Blogging/Posts/PostRepository_Tests.cs | 12 +++ .../Blogging/Tagging/TagRepository_Tests.cs | 12 +++ .../Volo.Blogging.MongoDB.Tests.csproj | 19 +++++ .../Blogging/Blogs/BlogRepository_Tests.cs | 12 +++ .../Comments/CommentRepository_Tests.cs | 12 +++ .../MongoDB/BloggingMongoDBTestModule.cs | 34 +++++++++ .../Blogging/Posts/PostRepository_Tests.cs | 12 +++ .../Blogging/Tagging/TagRepository_Tests.cs | 12 +++ .../Volo/Blogging/BloggingTestData.cs | 2 + .../Volo/Blogging/BloggingTestDataBuilder.cs | 7 +- .../Comments/CommentRepository_Tests.cs | 54 ++++++++++++++ .../Blogging/Posts/PostRepository_Tests.cs | 41 +++++++++++ .../Blogging/Tagging/TagRepository_Tests.cs | 73 +++++++++++++++++++ .../Users/BlogUserRepository_Tests.cs | 13 ++++ 17 files changed, 337 insertions(+), 6 deletions(-) create mode 100644 modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj create mode 100644 modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs create mode 100644 modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Comments/CommentRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Posts/PostRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Tagging/TagRepository_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Users/BlogUserRepository_Tests.cs diff --git a/modules/blogging/Volo.Blogging.sln b/modules/blogging/Volo.Blogging.sln index 05982d4524..fc1319161c 100644 --- a/modules/blogging/Volo.Blogging.sln +++ b/modules/blogging/Volo.Blogging.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2026 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28729.10 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Blogging.Domain.Shared", "src\Volo.Blogging.Domain.Shared\Volo.Blogging.Domain.Shared.csproj", "{F1D954AD-001A-4533-A8CC-94DDCF70B552}" EndProject @@ -35,9 +35,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Blogging.EntityFramewo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Blogging.Application.Tests", "test\Volo.Blogging.Application.Tests\Volo.Blogging.Application.Tests.csproj", "{C949B953-80B3-4B36-B535-1AD74A34FEAC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Blogging.MongoDB", "src\Volo.Blogging.MongoDB\Volo.Blogging.MongoDB.csproj", "{98C2D36A-F874-405D-8565-9CE59438E879}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Blogging.MongoDB", "src\Volo.Blogging.MongoDB\Volo.Blogging.MongoDB.csproj", "{98C2D36A-F874-405D-8565-9CE59438E879}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.BloggingTestApp.MongoDb", "app\Volo.BloggingTestApp.MongoDb\Volo.BloggingTestApp.MongoDb.csproj", "{4C818374-2DE8-422F-8585-975E8366DB26}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.BloggingTestApp.MongoDb", "app\Volo.BloggingTestApp.MongoDb\Volo.BloggingTestApp.MongoDb.csproj", "{4C818374-2DE8-422F-8585-975E8366DB26}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Blogging.MongoDB.Tests", "test\Volo.Blogging.MongoDB.Tests\Volo.Blogging.MongoDB.Tests.csproj", "{0A29F64C-11F1-40B6-8E6D-91E86823775E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -105,6 +107,10 @@ Global {4C818374-2DE8-422F-8585-975E8366DB26}.Debug|Any CPU.Build.0 = Debug|Any CPU {4C818374-2DE8-422F-8585-975E8366DB26}.Release|Any CPU.ActiveCfg = Release|Any CPU {4C818374-2DE8-422F-8585-975E8366DB26}.Release|Any CPU.Build.0 = Release|Any CPU + {0A29F64C-11F1-40B6-8E6D-91E86823775E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A29F64C-11F1-40B6-8E6D-91E86823775E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A29F64C-11F1-40B6-8E6D-91E86823775E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A29F64C-11F1-40B6-8E6D-91E86823775E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -125,6 +131,7 @@ Global {C949B953-80B3-4B36-B535-1AD74A34FEAC} = {25B3A516-5C0D-42E3-9294-E8A9346CEE4B} {98C2D36A-F874-405D-8565-9CE59438E879} = {42BF26EF-B8C7-42DC-9FFB-3653109B7776} {4C818374-2DE8-422F-8585-975E8366DB26} = {EB4FB44A-FE39-4245-9DAD-D6437BCE3870} + {0A29F64C-11F1-40B6-8E6D-91E86823775E} = {25B3A516-5C0D-42E3-9294-E8A9346CEE4B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F2BAE819-78D4-407A-9201-22473B2850B0} diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs index 1dedad184b..e2fcdca96c 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs @@ -44,6 +44,7 @@ namespace Volo.Blogging.Tagging foreach (var tag in tags) { tag.DecreaseUsageCount(); + Update(tag); } } } diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs new file mode 100644 index 0000000000..2765479e2f --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Blogging.EntityFrameworkCore; + +namespace Volo.Blogging.Comments +{ + public class CommentRepository_Tests : CommentRepository_Tests + { + + } +} diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs new file mode 100644 index 0000000000..22dd376aaf --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Blogging.EntityFrameworkCore; + +namespace Volo.Blogging.Posts +{ + public class PostRepository_Tests : PostRepository_Tests + { + + } +} diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs new file mode 100644 index 0000000000..65ebebd4ff --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Blogging.EntityFrameworkCore; + +namespace Volo.Blogging.Tagging +{ + public class TagRepository_Tests : TagRepository_Tests + { + + } +} diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj new file mode 100644 index 0000000000..c3c24c1e05 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj @@ -0,0 +1,19 @@ + + + + netcoreapp2.2 + + false + + + + + + + + + + + + + diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs new file mode 100644 index 0000000000..3cf6c37080 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Blogging.Blogs; + +namespace Volo.Blogging.MongoDB +{ + public class BlogRepository_Tests : BlogRepository_Tests + { + + } +} diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs new file mode 100644 index 0000000000..8bf936d9df --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Blogging.Comments; + +namespace Volo.Blogging.MongoDB +{ + public class CommentRepository_Tests : CommentRepository_Tests + { + + } +} diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs new file mode 100644 index 0000000000..7ac35300ab --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Mongo2Go; +using Volo.Abp; +using Volo.Abp.Data; +using Volo.Abp.Modularity; + +namespace Volo.Blogging.MongoDB +{ + [DependsOn( + typeof(BloggingTestBaseModule), + typeof(BloggingMongoDbModule) + )] + public class BloggingMongoDBTestModule : AbpModule + { + private MongoDbRunner _mongoDbRunner; + + public override void ConfigureServices(ServiceConfigurationContext context) + { + _mongoDbRunner = MongoDbRunner.Start(); + + Configure(options => + { + options.ConnectionStrings.Default = _mongoDbRunner.ConnectionString; + }); + } + + public override void OnApplicationShutdown(ApplicationShutdownContext context) + { + _mongoDbRunner.Dispose(); + } + } +} diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs new file mode 100644 index 0000000000..b392d99a05 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Blogging.Posts; + +namespace Volo.Blogging.MongoDB.Tests.Volo.Blogging.Posts +{ + public class PostRepository_Tests : PostRepository_Tests + { + + } +} diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs new file mode 100644 index 0000000000..0fbc8b9d10 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Blogging.Tagging; + +namespace Volo.Blogging.MongoDB +{ + public class TagRepository_Tests : TagRepository_Tests + { + + } +} diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestData.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestData.cs index 72910fb6ca..9666201719 100644 --- a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestData.cs +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestData.cs @@ -9,6 +9,8 @@ namespace Volo.Blogging public Guid Blog1Post1Id { get; } = Guid.NewGuid(); public Guid Blog1Post2Id { get; } = Guid.NewGuid(); public Guid Blog1Post1Comment1Id { get; } = Guid.NewGuid(); + public Guid Blog1Post1Comment2Id { get; } = Guid.NewGuid(); public string Tag1Name { get; } = "Tag1Name"; + public string Tag2Name { get; } = "Tag2Name"; } } \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs index b830887fdd..9747478aa6 100644 --- a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs @@ -40,9 +40,12 @@ namespace Volo.Blogging { await _blogRepository.InsertAsync(new Blog(_testData.Blog1Id, "The First Blog", "blog-1")); await _postRepository.InsertAsync(new Post(_testData.Blog1Post1Id, _testData.Blog1Id, Guid.Empty, "title", "coverImage", "url")); - await _postRepository.InsertAsync(new Post(_testData.Blog1Post2Id, _testData.Blog1Id, Guid.Empty, "title", "coverImage", "url")); + await _postRepository.InsertAsync(new Post(_testData.Blog1Post2Id, _testData.Blog1Id, Guid.Empty, "title2", "coverImage2", "url2")); await _commentRepository.InsertAsync(new Comment(_testData.Blog1Post1Comment1Id,_testData.Blog1Post1Id,null,"text")); - await _tagRepository.InsertAsync(new Tag(_testData.Blog1Id, _testData.Tag1Name)); + await _commentRepository.InsertAsync(new Comment(_testData.Blog1Post1Comment2Id, _testData.Blog1Post1Id, _testData.Blog1Post1Comment1Id, "text")); + await _tagRepository.InsertAsync(new Tag(_testData.Blog1Id, _testData.Tag1Name, 10)); + await _tagRepository.InsertAsync(new Tag(_testData.Blog1Id, _testData.Tag2Name)); + } } } diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Comments/CommentRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Comments/CommentRepository_Tests.cs new file mode 100644 index 0000000000..04db9d9f0b --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Comments/CommentRepository_Tests.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Modularity; +using Xunit; + +namespace Volo.Blogging.Comments +{ + public abstract class CommentRepository_Tests : BloggingTestBase + where TStartupModule : IAbpModule + { + protected ICommentRepository CommentRepository { get; } + protected BloggingTestData BloggingTestData { get; } + + protected CommentRepository_Tests() + { + CommentRepository = GetRequiredService(); + BloggingTestData = GetRequiredService(); + } + + [Fact] + public async Task GetListOfPostAsync() + { + var comments = await CommentRepository.GetListOfPostAsync(BloggingTestData.Blog1Post1Id); + comments.ShouldNotBeNull(); + comments.Count.ShouldBe(2); + comments.ShouldAllBe(x => x.PostId == BloggingTestData.Blog1Post1Id); + } + + [Fact] + public async Task GetCommentCountOfPostAsync() + { + var count = await CommentRepository.GetCommentCountOfPostAsync(BloggingTestData.Blog1Post1Id); + count.ShouldBe(2); + } + + [Fact] + public async Task GetRepliesOfComment() + { + var comment = await CommentRepository.GetRepliesOfComment(BloggingTestData.Blog1Post1Comment1Id); + comment.ShouldNotBeNull(); + comment.ShouldContain(x => x.Id == BloggingTestData.Blog1Post1Comment2Id); + } + + [Fact] + public async Task DeleteOfPost() + { + await CommentRepository.DeleteOfPost(BloggingTestData.Blog1Post1Id); + (await CommentRepository.GetListAsync()).ShouldBeEmpty(); + } + } +} diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Posts/PostRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Posts/PostRepository_Tests.cs new file mode 100644 index 0000000000..ee21e200d9 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Posts/PostRepository_Tests.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Modularity; +using Xunit; + +namespace Volo.Blogging.Posts +{ + public abstract class PostRepository_Tests : BloggingTestBase + where TStartupModule : IAbpModule + { + protected IPostRepository PostRepository { get; } + protected BloggingTestData BloggingTestData { get; } + + protected PostRepository_Tests() + { + PostRepository = GetRequiredService(); + BloggingTestData = GetRequiredService(); + } + + [Fact] + public async Task GetListOfPostAsync() + { + var posts = await PostRepository.GetPostsByBlogId(BloggingTestData.Blog1Id); + posts.ShouldNotBeNull(); + posts.Count.ShouldBe(2); + posts.ShouldContain(x => x.Id == BloggingTestData.Blog1Post1Id); + posts.ShouldContain(x => x.Id == BloggingTestData.Blog1Post2Id); + } + + [Fact] + public async Task GetPostByUrl() + { + var post = await PostRepository.GetPostByUrl(BloggingTestData.Blog1Id, "url"); + post.ShouldNotBeNull(); + post.Url.ShouldBe("url"); + } + } +} diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Tagging/TagRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Tagging/TagRepository_Tests.cs new file mode 100644 index 0000000000..e1752ec200 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Tagging/TagRepository_Tests.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Modularity; +using Xunit; + +namespace Volo.Blogging.Tagging +{ + public abstract class TagRepository_Tests : BloggingTestBase + where TStartupModule : IAbpModule + { + protected ITagRepository TagRepository { get; } + protected BloggingTestData BloggingTestData { get; } + + protected TagRepository_Tests() + { + TagRepository = GetRequiredService(); + BloggingTestData = GetRequiredService(); + } + + [Fact] + public async Task GetListAsync() + { + var tags = await TagRepository.GetListAsync(BloggingTestData.Blog1Id); + tags.ShouldNotBeNull(); + tags.Count.ShouldBe(2); + } + + [Fact] + public async Task GetByNameAsync() + { + var tag = await TagRepository.GetByNameAsync(BloggingTestData.Blog1Id, BloggingTestData.Tag1Name); + tag.ShouldNotBeNull(); + tag.Name.ShouldBe(BloggingTestData.Tag1Name); + } + + [Fact] + public async Task FindByNameAsync() + { + var tag = await TagRepository.FindByNameAsync(BloggingTestData.Blog1Id, BloggingTestData.Tag1Name); + tag.ShouldNotBeNull(); + tag.Name.ShouldBe(BloggingTestData.Tag1Name); + } + + [Fact] + public async Task GetListAsync2() + { + var tagIds = (await TagRepository.GetListAsync()).Select(x => x.Id).ToList(); + var tags = await TagRepository.GetListAsync(tagIds); + tags.ShouldNotBeNull(); + tags.Count.ShouldBe(tagIds.Count); + } + + [Fact] + public async Task DecreaseUsageCountOfTags() + { + var tag = await TagRepository.FindByNameAsync(BloggingTestData.Blog1Id, BloggingTestData.Tag1Name); + var usageCount = tag.UsageCount; + + TagRepository.DecreaseUsageCountOfTags(new List() + { + tag.Id + }); + + var qq = await TagRepository.FindByNameAsync(BloggingTestData.Blog1Id, BloggingTestData.Tag1Name); + (await TagRepository.FindByNameAsync(BloggingTestData.Blog1Id, BloggingTestData.Tag1Name)).UsageCount + .ShouldBe(usageCount - 1); + } + } +} diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Users/BlogUserRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Users/BlogUserRepository_Tests.cs new file mode 100644 index 0000000000..3f0e3b7bf7 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Users/BlogUserRepository_Tests.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Abp.Modularity; + +namespace Volo.Blogging.Users +{ + public abstract class BlogUserRepository_Tests : BloggingTestBase + where TStartupModule : IAbpModule + { + + } +} From a6c744cd67f4b4bc2e07a62551879fc43f176258 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 5 Apr 2019 21:28:51 +0800 Subject: [PATCH 2/2] Add blog entity unit tests. --- modules/blogging/Volo.Blogging.sln | 9 ++- .../Volo/Blogging/Tagging/Tag.cs | 7 ++ .../Volo.Blogging.Application.Tests.csproj | 2 +- .../Volo.Blogging.Domain.Tests.csproj | 18 +++++ .../Abp/Blogging/BloggingDomainTestBase.cs | 11 +++ .../Abp/Blogging/BloggingDomainTestModule.cs | 12 ++++ .../Volo/Abp/Blogging/Blogs/Blog_Tests.cs | 32 +++++++++ .../Abp/Blogging/Comments/Comment_Tests.cs | 22 ++++++ .../Volo/Abp/Blogging/Posts/Post_Tests.cs | 65 +++++++++++++++++ .../Volo/Abp/Blogging/Tagging/Tag_Tests.cs | 64 +++++++++++++++++ .../Volo/Abp/Blogging/Users/BlogUser_Test.cs | 71 +++++++++++++++++++ .../Blogging/Blogs/BlogRepository_Tests.cs | 7 +- .../Comments/CommentRepository_Tests.cs | 10 +-- .../BloggingEntityFrameworkCoreTestModule.cs | 6 +- .../Blogging/Posts/PostRepository_Tests.cs | 10 +-- .../Blogging/Tagging/TagRepository_Tests.cs | 10 +-- .../Volo.Blogging.MongoDB.Tests.csproj | 2 +- .../Blogging/Blogs/BlogRepository_Tests.cs | 10 +-- .../Comments/CommentRepository_Tests.cs | 10 +-- .../MongoDB/BloggingMongoDBTestModule.cs | 10 ++- .../Blogging/Posts/PostRepository_Tests.cs | 10 +-- .../Blogging/Tagging/TagRepository_Tests.cs | 10 +-- .../Blogging/Tagging/TagRepository_Tests.cs | 2 +- 23 files changed, 344 insertions(+), 66 deletions(-) create mode 100644 modules/blogging/test/Volo.Blogging.Domain.Tests/Volo.Blogging.Domain.Tests.csproj create mode 100644 modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/BloggingDomainTestBase.cs create mode 100644 modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/BloggingDomainTestModule.cs create mode 100644 modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Blogs/Blog_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Comments/Comment_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Posts/Post_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs create mode 100644 modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Users/BlogUser_Test.cs diff --git a/modules/blogging/Volo.Blogging.sln b/modules/blogging/Volo.Blogging.sln index fc1319161c..1c4ac401bb 100644 --- a/modules/blogging/Volo.Blogging.sln +++ b/modules/blogging/Volo.Blogging.sln @@ -39,7 +39,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Blogging.MongoDB", "sr EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.BloggingTestApp.MongoDb", "app\Volo.BloggingTestApp.MongoDb\Volo.BloggingTestApp.MongoDb.csproj", "{4C818374-2DE8-422F-8585-975E8366DB26}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Blogging.MongoDB.Tests", "test\Volo.Blogging.MongoDB.Tests\Volo.Blogging.MongoDB.Tests.csproj", "{0A29F64C-11F1-40B6-8E6D-91E86823775E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Blogging.MongoDB.Tests", "test\Volo.Blogging.MongoDB.Tests\Volo.Blogging.MongoDB.Tests.csproj", "{0A29F64C-11F1-40B6-8E6D-91E86823775E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Blogging.Domain.Tests", "test\Volo.Blogging.Domain.Tests\Volo.Blogging.Domain.Tests.csproj", "{B6D7EF20-9921-490A-AA95-47E3E174DC9B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -111,6 +113,10 @@ Global {0A29F64C-11F1-40B6-8E6D-91E86823775E}.Debug|Any CPU.Build.0 = Debug|Any CPU {0A29F64C-11F1-40B6-8E6D-91E86823775E}.Release|Any CPU.ActiveCfg = Release|Any CPU {0A29F64C-11F1-40B6-8E6D-91E86823775E}.Release|Any CPU.Build.0 = Release|Any CPU + {B6D7EF20-9921-490A-AA95-47E3E174DC9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6D7EF20-9921-490A-AA95-47E3E174DC9B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6D7EF20-9921-490A-AA95-47E3E174DC9B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6D7EF20-9921-490A-AA95-47E3E174DC9B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -132,6 +138,7 @@ Global {98C2D36A-F874-405D-8565-9CE59438E879} = {42BF26EF-B8C7-42DC-9FFB-3653109B7776} {4C818374-2DE8-422F-8585-975E8366DB26} = {EB4FB44A-FE39-4245-9DAD-D6437BCE3870} {0A29F64C-11F1-40B6-8E6D-91E86823775E} = {25B3A516-5C0D-42E3-9294-E8A9346CEE4B} + {B6D7EF20-9921-490A-AA95-47E3E174DC9B} = {25B3A516-5C0D-42E3-9294-E8A9346CEE4B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F2BAE819-78D4-407A-9201-22473B2850B0} diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs index f89d5f981f..28d14d885d 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs @@ -44,6 +44,13 @@ namespace Volo.Blogging.Tagging { return; } + + if (UsageCount - number <= 0) + { + UsageCount = 0; + return; + } + UsageCount -= number; } diff --git a/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj index aa2837f443..a36f95ac50 100644 --- a/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj +++ b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj @@ -13,7 +13,7 @@ - + diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo.Blogging.Domain.Tests.csproj b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo.Blogging.Domain.Tests.csproj new file mode 100644 index 0000000000..b2911bddee --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo.Blogging.Domain.Tests.csproj @@ -0,0 +1,18 @@ + + + + netcoreapp2.2 + + false + + + + + + + + + + + + diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/BloggingDomainTestBase.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/BloggingDomainTestBase.cs new file mode 100644 index 0000000000..7d758ee699 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/BloggingDomainTestBase.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Volo.Blogging +{ + public abstract class BloggingDomainTestBase : BloggingTestBase + { + + } +} diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/BloggingDomainTestModule.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/BloggingDomainTestModule.cs new file mode 100644 index 0000000000..01ab4b07c7 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/BloggingDomainTestModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Modularity; + +namespace Volo.Blogging +{ + [DependsOn( + typeof(BloggingEntityFrameworkCoreTestModule), + typeof(BloggingTestBaseModule) + )] + public class BloggingDomainTestModule : AbpModule + { + } +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Blogs/Blog_Tests.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Blogs/Blog_Tests.cs new file mode 100644 index 0000000000..6c44885dde --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Blogs/Blog_Tests.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Shouldly; +using Volo.Blogging.Blogs; +using Xunit; + +namespace Volo.Blogging +{ + public class Blog_Tests + { + [Theory] + [InlineData("aaa")] + [InlineData("bbb")] + public void SetName(string name) + { + var blog = new Blog(Guid.NewGuid(), "test blog", "test"); + blog.SetName(name); + blog.Name.ShouldBe(name); + } + + [Theory] + [InlineData("aaa")] + [InlineData("bbb")] + public void SetShortName(string name) + { + var blog = new Blog(Guid.NewGuid(), "test blog", "test"); + blog.SetShortName(name); + blog.ShortName.ShouldBe(name); + } + } +} diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Comments/Comment_Tests.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Comments/Comment_Tests.cs new file mode 100644 index 0000000000..34195d5f81 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Comments/Comment_Tests.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Shouldly; +using Volo.Blogging.Comments; +using Xunit; + +namespace Volo.Blogging +{ + public class Comment_Tests + { + [Theory] + [InlineData("aaa")] + [InlineData("bbb")] + public void SetText(string text) + { + var comment = new Comment(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "good"); + comment.SetText(text); + comment.Text.ShouldBe(text); + } + } +} diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Posts/Post_Tests.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Posts/Post_Tests.cs new file mode 100644 index 0000000000..91aede46a7 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Posts/Post_Tests.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Shouldly; +using Volo.Blogging.Comments; +using Volo.Blogging.Posts; +using Xunit; + +namespace Volo.Blogging +{ + public class Post_Tests + { + [Fact] + public void IncreaseReadCount() + { + var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io"); + post.IncreaseReadCount(); + post.ReadCount.ShouldBe(1); + } + + [Theory] + [InlineData("aaa")] + [InlineData("bbb")] + public void SetTitle(string title) + { + var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io"); + post.SetTitle(title); + post.Title.ShouldBe(title); + } + + [Theory] + [InlineData("aaa")] + [InlineData("bbb")] + public void SetUrl(string url) + { + var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io"); + post.SetUrl(url); + post.Url.ShouldBe(url); + } + + [Fact] + public void AddTag() + { + var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io"); + var tagId = Guid.NewGuid(); + post.AddTag(tagId); + post.Tags.ShouldContain(x => x.TagId == tagId); + } + + + [Fact] + public void RemoveTag() + { + var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io"); + var tagId = Guid.NewGuid(); + post.AddTag(tagId); + + post.Tags.ShouldContain(x => x.TagId == tagId); + + post.RemoveTag(tagId); + post.Tags.ShouldNotContain(x => x.TagId == tagId); + } + + } +} diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs new file mode 100644 index 0000000000..a4368a6341 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Shouldly; +using Volo.Blogging.Tagging; +using Xunit; + +namespace Volo.Blogging +{ + public class Tag_Tests + { + [Theory] + [InlineData("aaa")] + [InlineData("bbb")] + public void SetName(string name) + { + var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + tag.SetName(name); + tag.Name.ShouldBe(name); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void IncreaseUsageCount(int number) + { + var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + tag.IncreaseUsageCount(number); + tag.UsageCount.ShouldBe(number); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void DecreaseUsageCount(int number) + { + var tag = new Tag(Guid.NewGuid(), "abp", 10, "abp tag"); + tag.DecreaseUsageCount(number); + tag.UsageCount.ShouldBe(10 - number); + } + + [Fact] + public void DecreaseUsageCount_Should_Greater_ThanOrEqual_Zero() + { + var tag = new Tag(Guid.NewGuid(), "abp", 10, "abp tag"); + tag.DecreaseUsageCount(100); + tag.UsageCount.ShouldBe(0); + } + + [Theory] + [InlineData("aaa")] + [InlineData("bbb")] + public void SetDescription(string description) + { + var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + tag.SetDescription(description); + tag.Description.ShouldBe(description); + } + + + } +} diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Users/BlogUser_Test.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Users/BlogUser_Test.cs new file mode 100644 index 0000000000..e407d6f3f0 --- /dev/null +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Users/BlogUser_Test.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text; +using Shouldly; +using Volo.Abp.Users; +using Volo.Blogging.Users; +using Xunit; + +namespace Volo.Blogging +{ + public class BlogUser_Test + { + [Fact] + public void Update() + { + var userId = Guid.NewGuid(); + var tenantId = Guid.NewGuid(); + var blogUser = new BlogUser(new UserData(userId, "bob lee", "boblee@volosoft.com", "lee", "bob", true, + "123456", true, tenantId)); + var userData = new UserData(userId, "lee bob", "leebob@volosoft.com", "bob", "lee", false, + "654321", false, tenantId); + + blogUser.Update(userData); + + blogUser.Equals(new BlogUser(userData)).ShouldBeTrue(); + } + + [Fact] + public void Update_User_Id_Must_Equals() + { + var userId = Guid.NewGuid(); + var tenantId = Guid.NewGuid(); + var blogUser = new BlogUser(new UserData(userId, "bob lee", "boblee@volosoft.com", "lee", "bob", true, + "123456", true, tenantId)); + + var userData = new UserData(Guid.NewGuid(), "lee bob", "leebob@volosoft.com", "bob", "lee", false, + "654321", false, tenantId); + + Assert.Throws(() => blogUser.Update(userData)); + } + + [Fact] + public void Update_Tenant_Id_Must_Equals() + { + var userId = Guid.NewGuid(); + var tenantId = Guid.NewGuid(); + var blogUser = new BlogUser(new UserData(userId, "bob lee", "boblee@volosoft.com", "lee", "bob", true, + "123456", true, tenantId)); + + var userData = new UserData(userId, "lee bob", "leebob@volosoft.com", "bob", "lee", false, + "654321", false, Guid.NewGuid()); + + Assert.Throws(() => blogUser.Update(userData)); + } + + [Fact] + public void BlogUserEquals() + { + var userId = Guid.NewGuid(); + var tenantId = Guid.NewGuid(); + var blogUser = new BlogUser(new UserData(userId, "bob lee", "john@volosoft.com", "lee", "bob", true, + "123456", true, tenantId)); + + var blogUser2= new BlogUser(new UserData(userId, "bob lee", "john@volosoft.com", "lee", "bob", true, + "123456", true, tenantId)); + + blogUser.Equals(blogUser2).ShouldBeTrue(); + } + } +} diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs index b86945418c..4735926cc2 100644 --- a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs @@ -1,9 +1,8 @@ -using Volo.Blogging.EntityFrameworkCore; +using Volo.Blogging.Blogs; -namespace Volo.Blogging.Blogs +namespace Volo.Blogging { public class BlogRepository_Tests : BlogRepository_Tests { - } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs index 2765479e2f..5013e633fb 100644 --- a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Blogging.EntityFrameworkCore; +using Volo.Blogging.Comments; -namespace Volo.Blogging.Comments +namespace Volo.Blogging { public class CommentRepository_Tests : CommentRepository_Tests { - } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/EntityFrameworkCore/BloggingEntityFrameworkCoreTestModule.cs b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/EntityFrameworkCore/BloggingEntityFrameworkCoreTestModule.cs index 67c5f7ce8b..59f0be4a24 100644 --- a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/EntityFrameworkCore/BloggingEntityFrameworkCoreTestModule.cs +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/EntityFrameworkCore/BloggingEntityFrameworkCoreTestModule.cs @@ -2,12 +2,12 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; -using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; +using Volo.Blogging.EntityFrameworkCore; -namespace Volo.Blogging.EntityFrameworkCore +namespace Volo.Blogging { [DependsOn( typeof(BloggingEntityFrameworkCoreModule), @@ -49,4 +49,4 @@ namespace Volo.Blogging.EntityFrameworkCore _sqliteConnection.Dispose(); } } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs index 22dd376aaf..e23247de86 100644 --- a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Blogging.EntityFrameworkCore; +using Volo.Blogging.Posts; -namespace Volo.Blogging.Posts +namespace Volo.Blogging { public class PostRepository_Tests : PostRepository_Tests { - } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs index 65ebebd4ff..5de23c7665 100644 --- a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Blogging.EntityFrameworkCore; +using Volo.Blogging.Tagging; -namespace Volo.Blogging.Tagging +namespace Volo.Blogging { public class TagRepository_Tests : TagRepository_Tests { - } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj index c3c24c1e05..093113db66 100644 --- a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj @@ -7,7 +7,7 @@ - + diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs index 3cf6c37080..333746f0f0 100644 --- a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Blogs/BlogRepository_Tests.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Blogging.Blogs; +using Volo.Blogging.Blogs; -namespace Volo.Blogging.MongoDB +namespace Volo.Blogging { public class BlogRepository_Tests : BlogRepository_Tests { - } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs index 8bf936d9df..353d22d3ee 100644 --- a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Comments/CommentRepository_Tests.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Blogging.Comments; +using Volo.Blogging.Comments; -namespace Volo.Blogging.MongoDB +namespace Volo.Blogging { public class CommentRepository_Tests : CommentRepository_Tests { - } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs index 7ac35300ab..dc2c1cd47d 100644 --- a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs @@ -1,12 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Mongo2Go; +using Mongo2Go; using Volo.Abp; using Volo.Abp.Data; using Volo.Abp.Modularity; +using Volo.Blogging.MongoDB; -namespace Volo.Blogging.MongoDB +namespace Volo.Blogging { [DependsOn( typeof(BloggingTestBaseModule), @@ -31,4 +29,4 @@ namespace Volo.Blogging.MongoDB _mongoDbRunner.Dispose(); } } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs index b392d99a05..6fbaed0768 100644 --- a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Posts/PostRepository_Tests.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Blogging.Posts; +using Volo.Blogging.Posts; -namespace Volo.Blogging.MongoDB.Tests.Volo.Blogging.Posts +namespace Volo.Blogging { public class PostRepository_Tests : PostRepository_Tests { - } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs index 0fbc8b9d10..c727ef00b3 100644 --- a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/Tagging/TagRepository_Tests.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Blogging.Tagging; +using Volo.Blogging.Tagging; -namespace Volo.Blogging.MongoDB +namespace Volo.Blogging { public class TagRepository_Tests : TagRepository_Tests { - } -} +} \ No newline at end of file diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Tagging/TagRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Tagging/TagRepository_Tests.cs index e1752ec200..a81c7dde1e 100644 --- a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Tagging/TagRepository_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Tagging/TagRepository_Tests.cs @@ -65,7 +65,7 @@ namespace Volo.Blogging.Tagging tag.Id }); - var qq = await TagRepository.FindByNameAsync(BloggingTestData.Blog1Id, BloggingTestData.Tag1Name); + await TagRepository.FindByNameAsync(BloggingTestData.Blog1Id, BloggingTestData.Tag1Name); (await TagRepository.FindByNameAsync(BloggingTestData.Blog1Id, BloggingTestData.Tag1Name)).UsageCount .ShouldBe(usageCount - 1); }