public void CanChangeLoginName() { // Arrange User user = new User() { LoginName = "Bob" }; FakeRepository repository = new FakeRepository(); repository.Add(user); AdminController target = new AdminController(repository); string oldLogin = user.LoginName; string newLogin = "******"; // Action target.ChangeLoginName(oldLogin, newLogin); // Assert Assert.AreEqual(newLogin, user.LoginName); Assert.IsTrue(repository.DidSubmitChanges); }
public void Add(User user) { this.Users.Add(user); }