diff options
author | crupest <crupest@outlook.com> | 2019-04-21 00:08:59 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-21 00:08:59 +0800 |
commit | a9f248ad817683e911348cd168c570db3d07757f (patch) | |
tree | 9fa853690866f452a571b45fb062ac692d298a2e /Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs | |
parent | b86c8cf5130d21ac56e733640cecd08945d30e6d (diff) | |
download | timeline-a9f248ad817683e911348cd168c570db3d07757f.tar.gz timeline-a9f248ad817683e911348cd168c570db3d07757f.tar.bz2 timeline-a9f248ad817683e911348cd168c570db3d07757f.zip |
Reorgnize api. Add basic unit test.
Diffstat (limited to 'Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs')
-rw-r--r-- | Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs b/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs index 4a7f87fb..a34217f4 100644 --- a/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs +++ b/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs @@ -4,7 +4,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Timeline.Models; -using Timeline.Services; using Xunit.Abstractions; namespace Timeline.Tests.Helpers @@ -42,28 +41,10 @@ namespace Timeline.Tests.Helpers var scopedServices = scope.ServiceProvider; var db = scopedServices.GetRequiredService<DatabaseContext>(); - var passwordService = new PasswordService(null); - // Ensure the database is created. db.Database.EnsureCreated(); - db.Users.AddRange(new User[] { - new User - { - Id = 0, - Name = "user", - EncryptedPassword = passwordService.HashPassword("user"), - RoleString = "user" - }, - new User - { - Id = 0, - Name = "admin", - EncryptedPassword = passwordService.HashPassword("admin"), - RoleString = "user,admin" - } - }); - + db.Users.AddRange(TestMockUsers.MockUsers); db.SaveChanges(); } }); |