public void test_finding_user() { AspUser expected = new AspUser { UserName = "******", Id = "1", Email = "*****@*****.**" }; AspUser actual = UserServices.GetUser("admin"); expected.Id = actual.Id; actual.UserName = actual.UserName.ToLower(); Assert.IsTrue(expected.IsDeepEqual(actual)); }
public void test_adding_user() { Assert.IsTrue(UserServices.FindAll().Count == 1); AspUser expected = new AspUser { Email = "*****@*****.**", UserName = "******", Id = "2" }; UserServices.AddUser(expected.UserName, expected.Email, "Nq2gzAQK9w1N"); Assert.IsTrue(UserServices.FindAll().Count == 2); AspUser actual = UserServices.GetUser(expected.UserName); expected.Id = actual.Id; Assert.IsTrue(expected.IsDeepEqual(actual)); }
public AspUser CreateUser(string userName, string email, string password) { if (UserDataMock.FindByUserName(userName) != null) return null; AspUser user = new AspUser { UserName = userName, Email = email }; UserDataMock.Add(user); return user; }
public static void Update(AspUser user) { AspUser userInfo = _users.Find(t => t.UserName.Equals(user.UserName, StringComparison.OrdinalIgnoreCase)); int index = _users.IndexOf(userInfo); _users[index] = user; }
public static void Add(AspUser user) { user.Id = _nextId.ToString(); _users.Add(user); _nextId += 1; }