public void Test_That_IsAdmin_Returns_True_If_User_In_Admin_Group() { // Arrange (Act) var user = TestFactory.User(1); user.Groups.Add(TestFactory.AdminGroup()); // Assert Assert.True(user.IsAdmin); }
public void Test_That_Admin_Returns_True_If_User_In_Admin_Group() { // Arrange (Act) var user = TestFactory.User(1); var grp = TestFactory.AdminGroup(); user.Groups.Add(grp); var token = TestFactory.Token(1); token.User = user; // Assert Assert.True(token.Admin); }
public void Test_That_IsCodeValid_Returns_True_For_Valid_Code_With_Admin_Rights() { // Arrange var token = TestFactory.Token(1); var user = TestFactory.User(1); var adminGroup = TestFactory.AdminGroup(); user.Groups.Add(adminGroup); token.User = user; mockRepo.Setup(m => m.SingleOrDefault(It.IsAny <Func <Token, bool> >())).Returns(token); // Act var response = testService.IsCodeValid("abcde", true); // Assert Assert.AreEqual(response, true); }