public void CanUpdateUser() { User user = new User { Id = "Added-Test-User", UserName = "******", Email = "*****@*****.**", AccessFailedCount = 0, TwoFactorEnabled = false, EmailConfirmed = false, PhoneNumber = null, PhoneNumberConfirmed = false, LockoutEndDateUtc = null, LockoutEnabled = false, PasswordHash = null, SecurityStamp = null, UserRole = "Admin" }; UserRepositoryADO repo = new UserRepositoryADO(); repo.Insert(user); user.UserName = "******"; user.Email = "*****@*****.**"; user.TwoFactorEnabled = true; user.PhoneNumber = "804-555-5555"; user.PhoneNumberConfirmed = true; user.UserRole = "Sales"; user.PasswordHash = "APTyyq+Bp99LHIKp2XOeOiLot5b/Li+db4pQdafI6FN6xfBhCkfOKzl/s0SQ5CjOfg=="; repo.Update(user); List <User> users = repo.GetUsers().ToList(); Assert.AreEqual(5, users.Count); Assert.AreEqual("Added-Test-User", users[4].Id); Assert.AreEqual("Updated User", users[4].UserName); Assert.AreEqual("APTyyq+Bp99LHIKp2XOeOiLot5b/Li+db4pQdafI6FN6xfBhCkfOKzl/s0SQ5CjOfg==", users[4].PasswordHash); Assert.AreEqual("*****@*****.**", users[4].Email); Assert.AreEqual(0, users[4].AccessFailedCount); Assert.IsTrue(users[4].TwoFactorEnabled); Assert.IsFalse(users[4].EmailConfirmed); Assert.IsTrue(users[4].PhoneNumberConfirmed); Assert.IsFalse(users[4].LockoutEnabled); Assert.AreEqual("804-555-5555", users[4].PhoneNumber); Assert.IsTrue(users[4].LockoutEndDateUtc == DateTime.MinValue); Assert.IsTrue(string.IsNullOrEmpty(users[4].SecurityStamp)); Assert.AreEqual("Sales", users[4].UserRole); }
public void CanAddUser() { User user = new User { Id = "Added-Test-User", UserName = "******", Email = "*****@*****.**", AccessFailedCount = 0, TwoFactorEnabled = false, EmailConfirmed = false, PhoneNumber = null, PhoneNumberConfirmed = false, LockoutEndDateUtc = null, LockoutEnabled = false, PasswordHash = null, SecurityStamp = null, UserRole = "Admin" }; UserRepositoryADO repo = new UserRepositoryADO(); repo.Insert(user); List <User> users = repo.GetUsers().ToList(); Assert.AreEqual(5, users.Count); Assert.AreEqual("Added-Test-User", users[4].Id); Assert.AreEqual("Added User", users[4].UserName); Assert.AreEqual("*****@*****.**", users[4].Email); Assert.AreEqual(0, users[4].AccessFailedCount); Assert.IsFalse(users[4].TwoFactorEnabled); Assert.IsFalse(users[4].EmailConfirmed); Assert.IsFalse(users[4].PhoneNumberConfirmed); Assert.IsFalse(users[4].LockoutEnabled); Assert.IsTrue(string.IsNullOrEmpty(users[4].PhoneNumber)); Assert.IsTrue(users[4].LockoutEndDateUtc == DateTime.MinValue); Assert.IsTrue(string.IsNullOrEmpty(users[4].PasswordHash)); Assert.IsTrue(string.IsNullOrEmpty(users[4].SecurityStamp)); Assert.AreEqual("Admin", users[4].UserRole); }