示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }