public void PostRegisterTest() { TestUserRepository repository = new TestUserRepository(); UserController controller = new UserController(repository); User user = GetTestUser(); controller.Register(user); IEnumerable <User> users = repository.GetAllTestUsers(); Assert.IsTrue(users.Contains(user)); }
public void PostDeleteTest() { TestUserRepository testRepository = new TestUserRepository(); UserController usercontroller = GetUserController(testRepository); int id = 1; User user = TestUserRepository._db.SingleOrDefault(b => b.Id == id); usercontroller.PostDelete(id); IEnumerable <User> users = testRepository.GetAllTestUsers(); Assert.IsFalse(users.Contains(user)); }
public void PostEditTest() { User user = new User(); TestUserRepository testRepository = new TestUserRepository(); UserController usercontroller = GetUserController(testRepository); user = GetTestUser(); usercontroller.Edit(user); IEnumerable <User> users = testRepository.GetAllTestUsers(); Assert.IsTrue(users.Contains(user)); }