public void AoSolicitarRegistroDeNovoUsuarioValido_DeveRetornarVedadeiroCasoOUsuarioSejaSalvo() { var user = new User { Name = "Daniel Silva Moreira", Email = "*****@*****.**", Phone = "3133333333", CellPhone = "3188888888", Address = "Rua Teste", Number = 123, City = "Belo Horizonte", District = "Centro", ZipCode = 30246130, State = "MG", Password = "******", UserType = "user" }; var mockContext = new Mock<IAccountRepository>(); mockContext.Setup(x => x.SaveUser(user)).Returns(true); _business = new AccountBusiness(mockContext.Object); var result = _business.SaveUser(user); Assert.IsTrue(result); }
public void AoSolicitarRegistroDeNovoUsuario_ACamadaDeNegociosDeveAcessarACamadaDeAcessoADadosParaSalvarOUsuario() { var user = new User { Name = "", Email = "", Phone = "", CellPhone = "", Address = "", Number = 0, City = "", District = "", ZipCode = 0, State = "", Password = "", UserType = "" }; var mockContext = new Mock<IAccountRepository>(); mockContext.Setup(x => x.SaveUser(user)).Returns(true); _business = new AccountBusiness(mockContext.Object); _business.SaveUser(user); mockContext.Verify(x => x.SaveUser(user), Times.AtLeastOnce()); }
public void AoSolicitarRegistroDeNovoUsuarioInvalido_DeveRetornarFalsoCasoOUsuarioSejaSalvo() { var user = new User { Name = "", Email = "", Phone = "", CellPhone = "", Address = "", Number = 0, District = "", City = "", ZipCode = 0, State = "", Password = "", UserType = "" }; var mockContext = new Mock<IAccountRepository>(); mockContext.Setup(x => x.SaveUser(user)).Returns(false); _business = new AccountBusiness(mockContext.Object); var result = _business.SaveUser(user); Assert.IsFalse(result); }