aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-04-21 00:08:59 +0800
committercrupest <crupest@outlook.com>2019-04-21 00:08:59 +0800
commit076e0131dff71a9f76fff13c92fffa0ef408935f (patch)
tree9fa853690866f452a571b45fb062ac692d298a2e /Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs
parent325d4c7dbfba45e9c5a7518279831f54c4690d20 (diff)
downloadtimeline-076e0131dff71a9f76fff13c92fffa0ef408935f.tar.gz
timeline-076e0131dff71a9f76fff13c92fffa0ef408935f.tar.bz2
timeline-076e0131dff71a9f76fff13c92fffa0ef408935f.zip
Reorgnize api. Add basic unit test.
Diffstat (limited to 'Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs')
-rw-r--r--Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs21
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();
}
});