diff --git a/src/Abp.Samples.Blog.Application/Abp.Samples.Blog.Application.csproj b/src/Abp.Samples.Blog.Application/Abp.Samples.Blog.Application.csproj
index 4e6b931..b58a23d 100644
--- a/src/Abp.Samples.Blog.Application/Abp.Samples.Blog.Application.csproj
+++ b/src/Abp.Samples.Blog.Application/Abp.Samples.Blog.Application.csproj
@@ -83,7 +83,7 @@
-
+
diff --git a/src/Abp.Samples.Blog.Application/AbpSampleBlogCoreModule.cs b/src/Abp.Samples.Blog.Application/AbpSampleBlogApplicationModule.cs
similarity index 74%
rename from src/Abp.Samples.Blog.Application/AbpSampleBlogCoreModule.cs
rename to src/Abp.Samples.Blog.Application/AbpSampleBlogApplicationModule.cs
index 206ad9f..7e67759 100644
--- a/src/Abp.Samples.Blog.Application/AbpSampleBlogCoreModule.cs
+++ b/src/Abp.Samples.Blog.Application/AbpSampleBlogApplicationModule.cs
@@ -1,9 +1,10 @@
using System.Reflection;
+using Abp.AutoMapper;
using Abp.Modules;
namespace Abp.Samples.Blog
{
- [DependsOn(typeof(AbpSampleBlogCoreModule))]
+ [DependsOn(typeof(AbpSampleBlogCoreModule), typeof(AbpAutoMapperModule))]
public class AbpSampleBlogApplicationModule : AbpModule
{
public override void Initialize()
diff --git a/src/Abp.Samples.Blog.Tests/Abp.Samples.Blog.Tests.csproj b/src/Abp.Samples.Blog.Tests/Abp.Samples.Blog.Tests.csproj
index dfb904e..92e059d 100644
--- a/src/Abp.Samples.Blog.Tests/Abp.Samples.Blog.Tests.csproj
+++ b/src/Abp.Samples.Blog.Tests/Abp.Samples.Blog.Tests.csproj
@@ -88,6 +88,9 @@
..\packages\NMemory.1.0.1\lib\net45\NMemory.dll
+
+ ..\packages\Shouldly.2.5.0\lib\net40\Shouldly.dll
+
..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
diff --git a/src/Abp.Samples.Blog.Tests/Data/BlogTestDataBuilder.cs b/src/Abp.Samples.Blog.Tests/Data/BlogTestDataBuilder.cs
index a5a9508..e0fab86 100644
--- a/src/Abp.Samples.Blog.Tests/Data/BlogTestDataBuilder.cs
+++ b/src/Abp.Samples.Blog.Tests/Data/BlogTestDataBuilder.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Abp.MultiTenancy;
+using System.Linq;
using Abp.Samples.Blog.Auth;
using Abp.Samples.Blog.Categories;
using Abp.Samples.Blog.EntityFramework;
@@ -36,14 +31,34 @@ namespace Abp.Samples.Blog.Tests.Data
private void CreatePosts()
{
- var admin = _context.Users.Single(u => u.TenantId == 1 && u.UserName == BlogUser.AdminUserName);
+ const int defaultTenantId = 1;
- //TODO: ...
+ var adminUser = _context.Users.Single(u => u.TenantId == defaultTenantId && u.UserName == BlogUser.AdminUserName);
+ var programmingCategory = _context.Categories.Single(c => c.Name == "Programming");
- //_context.Posts.Add(new Post
- // {
-
- // });
+ _context.Posts.Add(
+ new Post
+ {
+ CategoryId = programmingCategory.Id,
+ Title = "Introduction to ASP.NET Boilerplate",
+ Content = "ASP.NET Boilerplate is a starting point for new modern web applications using best practices and most popular tools. It's aimed to be a solid model, a general-purpose application framework and a project template.",
+ Status = PostStatus.Published,
+ Tags = "domain driven design",
+ CreatorUserId = adminUser.Id
+ });
+
+ _context.Posts.Add(
+ new Post
+ {
+ CategoryId = programmingCategory.Id,
+ Title = "Unit testing in C# using xUnit, Entity Framework, Effort and ASP.NET Boilerplate.",
+ Content = "Implemented unit and integration tests on ASP.NET Boilerplate framework using xUnit, Entity Framework, Effort and Shouldly. See http://www.codeproject.com/Articles/871786/Unit-testing-in-Csharp-using-xUnit-Entity-Framewor for details...",
+ Status = PostStatus.Published,
+ Tags = "domain driven design",
+ CreatorUserId = adminUser.Id
+ });
+
+ _context.SaveChanges();
}
}
}
diff --git a/src/Abp.Samples.Blog.Tests/Posts/PostAppService_Tests.cs b/src/Abp.Samples.Blog.Tests/Posts/PostAppService_Tests.cs
index 04f360a..23b9ec2 100644
--- a/src/Abp.Samples.Blog.Tests/Posts/PostAppService_Tests.cs
+++ b/src/Abp.Samples.Blog.Tests/Posts/PostAppService_Tests.cs
@@ -1,5 +1,6 @@
using Abp.Samples.Blog.Posts;
using Abp.Samples.Blog.Posts.Dtos;
+using Shouldly;
using Xunit;
namespace Abp.Samples.Blog.Tests.Posts
@@ -17,6 +18,8 @@ namespace Abp.Samples.Blog.Tests.Posts
public void Should_Get_Posts()
{
var posts = _postAppService.GetPosts(new GetPostsInput());
+ posts.TotalCount.ShouldBe(2);
+ posts.Items.Count.ShouldBe(2);
}
}
}
diff --git a/src/Abp.Samples.Blog.Tests/packages.config b/src/Abp.Samples.Blog.Tests/packages.config
index d559d6e..2ef9c18 100644
--- a/src/Abp.Samples.Blog.Tests/packages.config
+++ b/src/Abp.Samples.Blog.Tests/packages.config
@@ -16,6 +16,7 @@
+