aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/TestUsers.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
commita9f248ad817683e911348cd168c570db3d07757f (patch)
tree9fa853690866f452a571b45fb062ac692d298a2e /Timeline.Tests/Helpers/TestUsers.cs
parentb86c8cf5130d21ac56e733640cecd08945d30e6d (diff)
downloadtimeline-a9f248ad817683e911348cd168c570db3d07757f.tar.gz
timeline-a9f248ad817683e911348cd168c570db3d07757f.tar.bz2
timeline-a9f248ad817683e911348cd168c570db3d07757f.zip
Reorgnize api. Add basic unit test.
Diffstat (limited to 'Timeline.Tests/Helpers/TestUsers.cs')
-rw-r--r--Timeline.Tests/Helpers/TestUsers.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/TestUsers.cs b/Timeline.Tests/Helpers/TestUsers.cs
new file mode 100644
index 00000000..b7005d54
--- /dev/null
+++ b/Timeline.Tests/Helpers/TestUsers.cs
@@ -0,0 +1,40 @@
+using System.Collections.Generic;
+using System.Linq;
+using Timeline.Entities;
+using Timeline.Models;
+using Timeline.Services;
+
+namespace Timeline.Tests.Helpers
+{
+ public static class TestMockUsers
+ {
+ static TestMockUsers()
+ {
+ var mockUsers = new List<User>();
+ var passwordService = new PasswordService(null);
+
+ mockUsers.Add(new User
+ {
+ Name = "user",
+ EncryptedPassword = passwordService.HashPassword("user"),
+ RoleString = "user"
+ });
+ mockUsers.Add(new User
+ {
+ Name = "admin",
+ EncryptedPassword = passwordService.HashPassword("admin"),
+ RoleString = "user,admin"
+ });
+
+ MockUsers = mockUsers;
+
+ var mockUserInfos = mockUsers.Select(u => new UserInfo(u)).ToList();
+ mockUserInfos.Sort(UserInfo.Comparer);
+ MockUserInfos = mockUserInfos;
+ }
+
+ public static List<User> MockUsers { get; }
+
+ public static IReadOnlyList<UserInfo> MockUserInfos { get; }
+ }
+}