Exemple #1
0
        async public Task ValidateAsync_WhenGivenValidModel_ValidIsTrue()
        {
            //Arrange
            Calculation calculation = CreateCalculation();

            CalculationModelValidator validator = new CalculationModelValidator();

            //Act
            ValidationResult result = await validator.ValidateAsync(calculation);

            //Assert
            result
            .IsValid
            .Should()
            .BeTrue();
        }
Exemple #2
0
        async public Task ValidateAsync_WhenCalculationSpecificationNameIsEmpty_ValidIsFalse()
        {
            //Arrange
            Calculation calculation = CreateCalculation();

            calculation.CalculationSpecification.Name = string.Empty;

            CalculationModelValidator validator = new CalculationModelValidator();

            //Act
            ValidationResult result = await validator.ValidateAsync(calculation);

            //Assert
            result
            .IsValid
            .Should()
            .BeFalse();
        }
Exemple #3
0
        async public Task ValidateAsync_WhenPoliciesIsempty_ValidIsFalse()
        {
            //Arrange
            Calculation calculation = CreateCalculation();

            calculation.Policies = new List <Reference>();

            CalculationModelValidator validator = new CalculationModelValidator();

            //Act
            ValidationResult result = await validator.ValidateAsync(calculation);

            //Assert
            result
            .IsValid
            .Should()
            .BeFalse();
        }
Exemple #4
0
        async public Task ValidateAsync_WhenFundingStreamIdIsEmpty_ValidIsFalse()
        {
            //Arrange
            Calculation calculation = CreateCalculation();

            calculation.FundingStream.Id = string.Empty;

            CalculationModelValidator validator = new CalculationModelValidator();

            //Act
            ValidationResult result = await validator.ValidateAsync(calculation);

            //Assert
            result
            .IsValid
            .Should()
            .BeFalse();
        }
Exemple #5
0
        async public Task ValidateAsync_WhenFundingStreamIsHasValue_ValidIsTrue()
        {
            //Arrange
            Calculation calculation = CreateCalculation();

            calculation.FundingStream = new Reference("fsid", "Funding Stream Name");

            CalculationModelValidator validator = new CalculationModelValidator();

            //Act
            ValidationResult result = await validator.ValidateAsync(calculation);

            //Assert
            result
            .IsValid
            .Should()
            .BeTrue();
        }
Exemple #6
0
        async public Task ValidateAsync_WhenFundingStreamIsNull_ValidIsTrue()
        {
            //Arrange
            Calculation calculation = CreateCalculation();

            calculation.FundingStream = null;

            CalculationModelValidator validator = new CalculationModelValidator();

            //Act
            ValidationResult result = await validator.ValidateAsync(calculation);

            //Assert
            result
            .IsValid
            .Should()
            .BeTrue();
        }
Exemple #7
0
        async public Task ValidateAsync_WhenSpecificationIsNull_ValidIsFalse()
        {
            //Arrange
            Calculation calculation = CreateCalculation();

            calculation.SpecificationId = null;

            CalculationModelValidator validator = new CalculationModelValidator();

            //Act
            ValidationResult result = await validator.ValidateAsync(calculation);

            //Assert
            result
            .IsValid
            .Should()
            .BeFalse();
        }