public void Should_Pass_validation()
        {
            var validator = new PaymentEventSuperficialValidator();
            var result    = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeTrue();
        }
        public void Fails_If_Funding_Source_Is_LessThan_0()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.FundingSource = 0;
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeFalse();
        }
        public void Fails_If_Apprenticeship_Id_Is_Negative()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.ApprenticeshipId = -1;
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeFalse();
        }
        public void Fails_If_Ukprn_Is_Negative()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.Ukprn = -1;
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeFalse();
        }
        public void Fails_If_Employer_Account_Id_Is_Not_Populated()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.EmployerAccountId = 0;
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeFalse();
        }
        public void Pass_If_Ids_are_equal_and_FundingSource_Levy()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.SendingEmployerAccountId = PaymentCreatedMessage.EmployerAccountId;
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeTrue();
        }
        public void Fails_If_Earning_Details_Are_Null()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.EarningDetails = null;
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeFalse();
        }
        public void Then_The_Validation_Fails_If_The_FundingSource_Is_Greater_Than_The_Allowed_Values()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.FundingSource = (Provider.Events.Api.Types.FundingSource) 6;
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeFalse();
        }
        public void Fails_If_Funding_Source_Is_CoInvestedEmployer_Or_FullyFundedSfa(FundingSource fundingSource)
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.FundingSource = FundingSourceConverter.ConvertToApiFundingSource(fundingSource);
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeFalse();
        }
        public void Should_have_different_employerid_if_transfer()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.SendingEmployerAccountId = PaymentCreatedMessage.EmployerAccountId + 1;
            PaymentCreatedMessage.FundingSource            = FundingSourceConverter.ConvertToApiFundingSource(FundingSource.Transfer);
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeTrue();
        }
        public void Fails_If_Ids_are_not_equal_and_FundingSource_Levy()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.SendingEmployerAccountId = PaymentCreatedMessage.EmployerAccountId + 1;
            PaymentCreatedMessage.FundingSource            = FundingSourceConverter.ConvertToApiFundingSource(FundingSource.Levy);
            var result = validator.Validate(PaymentCreatedMessage);

            result.IsValid.Should().BeFalse();
        }
        public void Actual_End_date_Is_Something_Message_Is_Still_Validated()
        {
            var validator = new PaymentEventSuperficialValidator();

            PaymentCreatedMessage.EarningDetails.ActualEndDate = DateTime.Today;
            PaymentCreatedMessage.FundingSource = (Provider.Events.Api.Types.FundingSource) 7;
            var result = validator.Validate(PaymentCreatedMessage);

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