public async Task CreateUser_ImpossibleToCreateUserWithDublicatedEmail() { //Arrange var context = _fixture.ZipPayDbContext; var usersProvider = new UsersProvider(context, _logger, _mapper); var user = new UserModel { Name = "Test", Email = "*****@*****.**", MonthlyExpenses = 1000, MonthlySalary = 1000 }; //Assert await Assert.ThrowsAsync <BadRequestException>(() => usersProvider.CreateUser(user)); }
public async Task CreateUser_DeltaBetweenSalaryAndExpensesIsNotSufficient() { //Arrange var context = _fixture.ZipPayDbContext; var usersProvider = new UsersProvider(context, _logger, _mapper); var user = new UserModel { Name = "Test100", Email = "*****@*****.**", MonthlyExpenses = 1000, MonthlySalary = 1000 }; //Act //Assert await Assert.ThrowsAsync <BadRequestException>(() => usersProvider.CreateUser(user)); }
public async Task CreateUser_UserIsCreated() { //Arrange var context = _fixture.ZipPayDbContext; var usersProvider = new UsersProvider(context, _logger, _mapper); var user = new UserModel { Name = "Test100", Email = "*****@*****.**", MonthlyExpenses = 1000, MonthlySalary = 2000 }; //Act var result = await usersProvider.CreateUser(user); //Assert Assert.NotNull(result); Assert.Equal(user.Name, result.Name); }