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

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

            result.DataLockErrorCode.Should().Be(DataLockErrorCode.DLOCK_04);
            result.ApprenticeshipPriceEpisodes.Should().HaveCount(0);
        }
Example #2
0
        public void WhenFrameworkCodeMatches_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
                        }
                    },
                    FrameworkCode = 123,
                },
                Aim = new LearningAim
                {
                    FrameworkCode = 123,
                },
            };

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

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