diff --git a/modules/blogging/Volo.Blogging.sln b/modules/blogging/Volo.Blogging.sln
index d50ace19a7..f9a49d767f 100644
--- a/modules/blogging/Volo.Blogging.sln
+++ b/modules/blogging/Volo.Blogging.sln
@@ -33,6 +33,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Blogging.TestBase", "t
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Blogging.EntityFrameworkCore.Tests", "test\Volo.Blogging.EntityFrameworkCore.Tests\Volo.Blogging.EntityFrameworkCore.Tests.csproj", "{0B9AAD44-1FCF-4AF1-838F-A09446E98E37}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Blogging.Application.Tests", "test\Volo.Blogging.Application.Tests\Volo.Blogging.Application.Tests.csproj", "{C949B953-80B3-4B36-B535-1AD74A34FEAC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -87,6 +89,10 @@ Global
{0B9AAD44-1FCF-4AF1-838F-A09446E98E37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B9AAD44-1FCF-4AF1-838F-A09446E98E37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B9AAD44-1FCF-4AF1-838F-A09446E98E37}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C949B953-80B3-4B36-B535-1AD74A34FEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C949B953-80B3-4B36-B535-1AD74A34FEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C949B953-80B3-4B36-B535-1AD74A34FEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C949B953-80B3-4B36-B535-1AD74A34FEAC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -104,6 +110,7 @@ Global
{14409939-5A35-4145-A5C4-F3AED1617243} = {EB4FB44A-FE39-4245-9DAD-D6437BCE3870}
{BBE8D8BE-1B24-49FE-86EF-3848D4BB6829} = {25B3A516-5C0D-42E3-9294-E8A9346CEE4B}
{0B9AAD44-1FCF-4AF1-838F-A09446E98E37} = {25B3A516-5C0D-42E3-9294-E8A9346CEE4B}
+ {C949B953-80B3-4B36-B535-1AD74A34FEAC} = {25B3A516-5C0D-42E3-9294-E8A9346CEE4B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F2BAE819-78D4-407A-9201-22473B2850B0}
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
new file mode 100644
index 0000000000..4af22bcc76
--- /dev/null
+++ b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj
@@ -0,0 +1,19 @@
+
+
+
+ netcoreapp2.1
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/BloggingApplicationTestModule.cs b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/BloggingApplicationTestModule.cs
new file mode 100644
index 0000000000..ccb7bbfa99
--- /dev/null
+++ b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/BloggingApplicationTestModule.cs
@@ -0,0 +1,20 @@
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Modularity;
+using Volo.Blogging.EntityFrameworkCore;
+
+namespace Volo.Blogging
+{
+ [DependsOn(
+ typeof(BloggingApplicationModule),
+ typeof(BloggingEntityFrameworkCoreTestModule),
+ typeof(BloggingTestBaseModule))]
+ public class BloggingApplicationTestModule : AbpModule
+ {
+ public override void ConfigureServices(IServiceCollection services)
+ {
+ services.AddAlwaysAllowAuthorization();
+
+ services.AddAssemblyOf();
+ }
+ }
+}
diff --git a/modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/QaApplicationTestBase.cs b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/QaApplicationTestBase.cs
new file mode 100644
index 0000000000..d973b607cb
--- /dev/null
+++ b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/QaApplicationTestBase.cs
@@ -0,0 +1,24 @@
+using System;
+using Volo.Blogging.EntityFrameworkCore;
+
+namespace Volo.Blogging
+{
+ public abstract class QaApplicationTestBase : BloggingTestBase
+ {
+ protected virtual void UsingDbContext(Action action)
+ {
+ using (var dbContext = GetRequiredService())
+ {
+ action.Invoke(dbContext);
+ }
+ }
+
+ protected virtual T UsingDbContext(Func action)
+ {
+ using (var dbContext = GetRequiredService())
+ {
+ return action.Invoke(dbContext);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestData.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestData.cs
new file mode 100644
index 0000000000..323e29d45f
--- /dev/null
+++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestData.cs
@@ -0,0 +1,12 @@
+using System;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Blogging
+{
+ public class BloggingTestData : ISingletonDependency
+ {
+ public Guid Blog1Id { get; } = Guid.NewGuid();
+ public Guid Blog1Post1Id { get; } = Guid.NewGuid();
+ public Guid Blog1Post2Id { get; } = Guid.NewGuid();
+ }
+}
\ 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 6b7a2f7a0d..e62f97b1fb 100644
--- a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs
+++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs
@@ -1,12 +1,31 @@
-using Volo.Abp.DependencyInjection;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Threading;
+using Volo.Blogging.Blogs;
namespace Volo.Blogging
{
public class BloggingTestDataBuilder : ITransientDependency
{
+ private readonly BloggingTestData _testData;
+ private readonly IBlogRepository _blogRepository;
+
+ public BloggingTestDataBuilder(
+ BloggingTestData testData,
+ IBlogRepository blogRepository)
+ {
+ _testData = testData;
+ _blogRepository = blogRepository;
+ }
+
public void Build()
{
- //TODO
+ AsyncHelper.RunSync(BuildAsync);
+ }
+
+ public async Task BuildAsync()
+ {
+ await _blogRepository.InsertAsync(new Blog(_testData.Blog1Id, "The First Blog", "blog-1"));
}
}
}
diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Blogs/BlogRepository_Tests.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Blogs/BlogRepository_Tests.cs
index 1a94490340..a6976fcc4d 100644
--- a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Blogs/BlogRepository_Tests.cs
+++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/Blogs/BlogRepository_Tests.cs
@@ -16,10 +16,10 @@ namespace Volo.Blogging.Blogs
}
[Fact]
- public async Task FindByShortNameAsync_Temp()
+ public async Task FindByShortNameAsync()
{
- var blog = await BlogRepository.FindByShortNameAsync("default");
- blog.ShouldBeNull();
+ var blog = await BlogRepository.FindByShortNameAsync("blog-1");
+ blog.ShouldNotBeNull();
}
}
}
\ No newline at end of file