diff options
author | 杨宇千 <crupest@outlook.com> | 2019-11-20 18:21:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 18:21:17 +0800 |
commit | 751467deb8ae18909ebd2b241bbb64f1f9da8295 (patch) | |
tree | 788b8acdf1141c757cb3226d3cd5f64594386b8f /Timeline.Tests/Mock/Data/TestUsers.cs | |
parent | 2de7fa95bb5ad0a10f74fb390bac464a250dee42 (diff) | |
parent | 33318b9244a82fee6d711aa15f853e1590ff13f7 (diff) | |
download | timeline-751467deb8ae18909ebd2b241bbb64f1f9da8295.tar.gz timeline-751467deb8ae18909ebd2b241bbb64f1f9da8295.tar.bz2 timeline-751467deb8ae18909ebd2b241bbb64f1f9da8295.zip |
Merge pull request #54 from crupest/timeline
Add core feature Timeline (currently only personal timeline)
Diffstat (limited to 'Timeline.Tests/Mock/Data/TestUsers.cs')
-rw-r--r-- | Timeline.Tests/Mock/Data/TestUsers.cs | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/Timeline.Tests/Mock/Data/TestUsers.cs b/Timeline.Tests/Mock/Data/TestUsers.cs deleted file mode 100644 index fa75236a..00000000 --- a/Timeline.Tests/Mock/Data/TestUsers.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System;
-using System.Collections.Generic;
-using Timeline.Entities;
-using Timeline.Models;
-using Timeline.Services;
-
-namespace Timeline.Tests.Mock.Data
-{
- public class MockUser
- {
- public MockUser(string username, string password, bool administrator)
- {
- Info = new UserInfo(username, administrator);
- Password = password;
- }
-
- public UserInfo Info { get; set; }
- public string Username => Info.Username;
- public string Password { get; set; }
- public bool Administrator => Info.Administrator;
-
-
- public static MockUser User { get; } = new MockUser("user", "userpassword", false);
- public static MockUser Admin { get; } = new MockUser("admin", "adminpassword", true);
-
- public static IReadOnlyList<UserInfo> UserInfoList { get; } = new List<UserInfo> { User.Info, Admin.Info };
-
- // emmmmmmm. Never reuse the user instances because EF Core uses them, which will cause strange things.
- public static IEnumerable<User> CreateMockEntities()
- {
- var passwordService = new PasswordService();
- User Create(MockUser user)
- {
- return new User
- {
- Name = user.Username,
- EncryptedPassword = passwordService.HashPassword(user.Password),
- RoleString = UserRoleConvert.ToString(user.Administrator),
- Avatar = null
- };
- }
-
- return new List<User>
- {
- Create(User),
- Create(Admin)
- };
- }
- }
-}
|