public void AddUser_ShouldWork() { // Arrange int expected = TestDB.GetUserTable().Count + 1; // Act bool validCall = container.AddUser(user); int result = container.Users.Count; // Assert Assert.Equal(expected, result); Assert.True(validCall); }
public void AddUser_ShouldWork() { // Arrange int expected = 1; // Act bool validCall = container.AddUser(user); int result = container.Users.Count; // Assert Assert.Equal(expected, result); Assert.True(validCall); Assert.Equal(user, container.Users[0]); }
public void AddUser_ShouldWork() { // Arrange int expected = 4; container = new UserContainer(repo.CreateUserContainerDal(), repo.CreateUserDAL(), repo.CreateBetDAL()); User toAdd = new User("Pablo", null, null) { Id = 13, }; bool validCall; // Act using (TransactionScope scope = new TransactionScope()) { validCall = container.AddUser(toAdd); // Assert Assert.True(validCall); Assert.Equal(expected, container.Users.Count); } }
public User AddUser(User user) { try { return(UserContainer.AddUser(user)); } catch (Exception ex) { //todo throw custom ex; throw ex; } }
public ActionResult Create(UserModel model) { try { // TODO: Add insert logic here if (container.AddUser(CreateUser(model))) { return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult RegisterUser(RegisterViewModel user) { //try add User voegt de waardes toe aan de database if (ModelState.IsValid) { try { userContainer.AddUser(user); ViewBag.SuccesOrNot = "You succesfully created an account!"; return(RedirectToAction("Login", "Account")); } catch { ViewBag.SuccesOrNot = "Your account could not be created!"; return(RedirectToAction("Register", "Account")); } } ViewBag.SuccesOrNot = "Please enter all required fields!"; return(RedirectToAction("Register", "Account")); }