public void DevolvedAreaSourceOfFunding_04_Error_ContractInvalid()
 {
     easRecord.FundingLine = "Adult Education - Eligible for MCA/GLA funding (non-procured)";
     easRecord.DevolvedAreaSourceOfFunding = "116";
     _validator = new BusinessRulesValidator(_contractAllocations, _fundingLineContractTypeMappings, paymentTypes, _devolvedContracts, _sofCodeDictionary, dateTimeProviderMock.Object, 1);
     _validator.ShouldHaveValidationErrorFor(x => x.DevolvedAreaSourceOfFunding, easRecord).WithErrorCode("DevolvedAreaSourceOfFunding_04");
 }
 public void HaveError_When_DevolvedSourceOfFundingExist_For_NonRequired_Fundlines(string fundingLine, string devolvedSourceOfFunding)
 {
     easRecord.FundingLine = fundingLine;
     easRecord.DevolvedAreaSourceOfFunding = devolvedSourceOfFunding;
     _validator = new BusinessRulesValidator(_contractAllocations, _fundingLineContractTypeMappings, paymentTypes, _devolvedContracts, _sofCodeDictionary, dateTimeProviderMock.Object, 1);
     _validator.ShouldHaveValidationErrorFor(x => x.DevolvedAreaSourceOfFunding, easRecord).WithErrorCode("DevolvedAreaSourceOfFunding_02");
 }
Example #3
0
        public void FundingLine_02_HaveError_When_ContractTypeIsNotFound_For_A_FundingLine()
        {
            var easRecord = new EasCsvRecord()
            {
                CalendarMonth  = "8",
                CalendarYear   = "2020",
                Value          = "1",
                FundingLine    = "FundingLineWithoutContract",
                AdjustmentType = "adjustmentType"
            };

            _validator = new BusinessRulesValidator(_contractAllocations, _fundingLineContractTypeMappings, paymentTypes, null, null, dateTimeProviderMock.Object, 1);
            _validator.ShouldHaveValidationErrorFor(x => x.FundingLine, easRecord).WithErrorCode("FundingLine_02");
        }
        public void HaveError_WhenCalendarMonth_Is_NotValid(string calendarMonth)
        {
            var easRecord = new EasCsvRecord()
            {
                CalendarMonth  = calendarMonth,
                CalendarYear   = "2020",
                Value          = "1",
                AdjustmentType = "AdjustmentType",
                FundingLine    = "FundingLine"
            };

            dateTimeProviderMock.Setup(x => x.GetNowUtc()).Returns(new DateTime(2020, 09, 01));
            _validator = new BusinessRulesValidator(null, null, paymentTypes, null, null, dateTimeProviderMock.Object, 1);
            _validator.ShouldHaveValidationErrorFor(x => x.CalendarMonth, easRecord).WithErrorCode("CalendarMonth_01");
        }
        public void HaveError_For_Invalid_FundingLine_Lookup()
        {
            var easRecord = new EasCsvRecord()
            {
                CalendarMonth  = "8",
                CalendarYear   = "2020",
                Value          = "1",
                FundingLine    = paymentTypes[0].FundingLine.Name,
                AdjustmentType = "InvalidAdjustmentType"
            };

            dateTimeProviderMock.Setup(x => x.GetNowUtc()).Returns(new DateTime(2020, 09, 01));
            _validator = new BusinessRulesValidator(null, null, paymentTypes, null, null, dateTimeProviderMock.Object, 1);
            _validator.ShouldHaveValidationErrorFor(x => x.AdjustmentType, easRecord).WithErrorCode("AdjustmentType_02");
        }
Example #6
0
        public void FundingLine_01_HaveError_When_FundingLine_IsNotFound(string fundingLine)
        {
            var easRecord = new EasCsvRecord()
            {
                CalendarMonth  = "8",
                CalendarYear   = "2020",
                Value          = "1",
                FundingLine    = fundingLine,
                AdjustmentType = "adjustmentType"
            };

            dateTimeProviderMock.Setup(x => x.GetNowUtc()).Returns(new DateTime(2020, 09, 01));
            _validator = new BusinessRulesValidator(null, null, paymentTypes, null, null, dateTimeProviderMock.Object, 1);
            _validator.ShouldHaveValidationErrorFor(x => x.FundingLine, easRecord).WithErrorCode("FundingLine_01");
        }
Example #7
0
        public void HaveError_For_Empty_Value(string value)
        {
            var easRecord = new EasCsvRecord()
            {
                CalendarMonth  = "8",
                CalendarYear   = "2018",
                FundingLine    = paymentTypes[0].FundingLine.Name,
                AdjustmentType = "adjustmentType",
                Value          = value
            };

            dateTimeProviderMock.Setup(x => x.GetNowUtc()).Returns(new DateTime(2018, 09, 01));
            _validator = new BusinessRulesValidator(null, null, paymentTypes, null, null, dateTimeProviderMock.Object, 1);
            _validator.ShouldHaveValidationErrorFor(x => x.Value, easRecord).WithErrorCode("Value_01");
        }
        public void HaveErrorWhenCalendarMonthAndYearAreNotInTheAcademicYear(string calendarMonth, string calendarYear)
        {
            var easRecord = new EasCsvRecord()
            {
                CalendarMonth  = calendarMonth,
                CalendarYear   = calendarYear,
                Value          = "1",
                AdjustmentType = "AdjustmentType",
                FundingLine    = "FundingLine"
            };

            // Mock future date , so that validation doesn't fail on Calendar Month future date
            dateTimeProviderMock.Setup(x => x.GetNowUtc()).Returns(new DateTime(2021, 10, 01));
            _validator = new BusinessRulesValidator(_contractAllocations, _fundingLineContractTypeMappings, paymentTypes, null, null, dateTimeProviderMock.Object, 1);
            _validator.ShouldHaveValidationErrorFor(x => x.CalendarMonth, easRecord).WithErrorCode("CalendarYearCalendarMonth_02");
        }
        public void HaveError_WhenCalendarYear_Is_NotValid(string calendarYear)
        {
            var easRecord = new EasCsvRecord()
            {
                CalendarMonth  = "12",
                CalendarYear   = calendarYear,
                Value          = "1",
                AdjustmentType = "AdjustmentType",
                FundingLine    = "FundingLine"
            };

            dateTimeProviderMock.Setup(x => x.GetNowUtc()).Returns(new DateTime(2020, 09, 01));
            _validator = new BusinessRulesValidator(null, null, paymentTypes, null, null, dateTimeProviderMock.Object, 1);
            _validator.ShouldHaveValidationErrorFor(x => x.CalendarYear, easRecord).WithErrorCode("CalendarYear_01");
            var result = _validator.Validate(easRecord);
            //Assert.False(result.IsValid);
            //Assert.Equal("The CalendarYear is not valid.", result.Errors[0].ErrorMessage);
            //Assert.Equal("CalendarYear_01", result.Errors[0].ErrorCode);
        }
Example #10
0
        public void FundingLine_02_Have_Error_WhenContractEndDate_IsLessThan_EasRecordDate(string year, string month)
        {
            _contractAllocations = new List <ContractAllocation>()
            {
                new ContractAllocation()
                {
                    FundingStreamPeriodCode = "APPS2021",
                    EndDate = new DateTime(2021, 07, 31)
                }
            };

            var easRecord = new EasCsvRecord()
            {
                AdjustmentType = "adjustment",
                FundingLine    = "FundingLine2021",
                CalendarYear   = year,
                CalendarMonth  = month,
                Value          = "10"
            };

            _validator = new BusinessRulesValidator(_contractAllocations, _fundingLineContractTypeMappings, paymentTypes, null, null, dateTimeProviderMock.Object, 1);
            _validator.ShouldHaveValidationErrorFor(x => x.FundingLine, easRecord).WithErrorCode("FundingLine_02");
        }