Exemplo n.º 1
0
        public void PaycheckService_OnWork_GenerateAValidPaycheck()
        {
            // Arrange
            var referenceMonth = DateTime.Now;
            var service        = new PaycheckService(new EmployeeValidator());

            // Act
            var paycheck = service.CreatePaycheck(_employeeFixture.GenerateValidEmployee(), referenceMonth).Result;

            // Assert
            Assert.True(paycheck.Payload != null);
            Assert.False(paycheck.ErrorMessages.Any());
        }
        public void EmployeeValidator_OnValidate_MustPassValidation()
        {
            // Arrange
            var validator = new EmployeeValidator();

            // Act
            var results = validator.Validate(_employeeFixture.GenerateValidEmployee());

            // Assert
            Assert.True(results.IsValid);
            Assert.True(!results.Errors.Any());
        }
        public void PaycheckValidator_OnValidade_MustPassValidation()
        {
            // Arrange
            var referenceMonth  = DateTime.Today;
            var validator       = new PaycheckValidator();
            var paycheckService = new PaycheckService(new EmployeeValidator());
            var paycheck        = paycheckService.CreatePaycheck(_employeeFixture.GenerateValidEmployee(), referenceMonth).Result;

            // Act
            var result = validator.Validate(paycheck.Payload);

            // Assert
            Assert.True(result.IsValid);
            Assert.False(result.Errors.Any());
        }