public void TestSwitchingOfUsers() { var user1 = UserMock.CreateUser("First User"); var user2 = UserMock.CreateUser("Second User(Admin)"); user1.DoAction((u) => { Assert.AreEqual("First User", u.Identity.Name); }); user2.DoAction((u) => { Assert.AreEqual("Second User(Admin)", u.Identity.Name); }); }
public void SecureArea() { // Arrange HomeController controller = new HomeController(); var user = UserMock.CreateUser("Kevin"); // Act user.DoAction((u) => { ViewResult result = controller.SecureArea() as ViewResult; // Assert Assert.AreEqual("Kevin", result.ViewBag.UserName); }); }
public void CreateUserShouldThrowAnErrorIfNoNameIsPassed() { UserMock.CreateUser(null); }
public void CreateUserShouldNotReturnNullEvenWithBlankName() { Assert.IsNotNull(UserMock.CreateUser("")); }
public void CreateUserShouldNotReturnNull() { Assert.IsNotNull(UserMock.CreateUser("Test name")); }