Example #1
0
        public void WhenPathwayCodeDoesNotMatch_ThenDLOCK_06()
        {
            var validation = new DataLockValidationModel
            {
                PriceEpisode = new PriceEpisode {
                    Identifier = PriceEpisodeIdentifier
                },
                EarningPeriod  = period,
                Apprenticeship = new ApprenticeshipModel
                {
                    Id = 1,
                    ApprenticeshipPriceEpisodes = new List <ApprenticeshipPriceEpisodeModel>
                    {
                        new ApprenticeshipPriceEpisodeModel
                        {
                            Id = 100
                        }
                    },
                    PathwayCode = 123,
                },
                Aim = new LearningAim
                {
                    PathwayCode = 124,
                },
            };

            var validator = new PathwayCodeValidator();
            var result    = validator.Validate(validation);

            result.DataLockErrorCode.Should().Be(DataLockErrorCode.DLOCK_06);
            result.ApprenticeshipPriceEpisodes.Should().HaveCount(0);
        }
Example #2
0
        public void WhenPathwayCodeMatches_ThenNoDatalock()
        {
            var validation = new DataLockValidationModel
            {
                PriceEpisode = new PriceEpisode {
                    Identifier = PriceEpisodeIdentifier
                },
                EarningPeriod  = period,
                Apprenticeship = new ApprenticeshipModel
                {
                    Id = 1,
                    ApprenticeshipPriceEpisodes = new List <ApprenticeshipPriceEpisodeModel>
                    {
                        new ApprenticeshipPriceEpisodeModel
                        {
                            Id = 100
                        }
                    },
                    PathwayCode = 123,
                },
                Aim = new LearningAim
                {
                    PathwayCode = 123,
                },
            };

            var validator = new PathwayCodeValidator();
            var result    = validator.Validate(validation);

            result.DataLockErrorCode.Should().BeNull();
            result.ApprenticeshipPriceEpisodes.Should().HaveCount(1);
            result.ApprenticeshipPriceEpisodes[0].Id.Should().Be(100);
        }