public void Then_The_Fields_Are_Mapped(ApprenticeshipFunding source)
        {
            //Act
            var actual = (GetStandardFundingResponse)source;

            //Assert
            actual.Should().BeEquivalentTo(source);
        }
        public void Then_The_Fields_Are_Mapped_Correctly(ApprenticeshipFunding apprenticeshipFunding)
        {
            var actual = (Domain.Courses.ApprenticeshipFunding)apprenticeshipFunding;

            actual.Should().BeEquivalentTo(apprenticeshipFunding, options => options
                                           .Excluding(c => c.Id)
                                           .Excluding(c => c.StandardUId)
                                           .Excluding(c => c.Standard)
                                           );
        }
Example #3
0
        public void Then_The_Fields_Are_Correctly_Mapped(ApprenticeshipFundingImport apprenticeshipFundingImport, string standardUId)
        {
            var actual = ApprenticeshipFunding.ConvertFrom(apprenticeshipFundingImport, standardUId);

            actual.Should().BeEquivalentTo(apprenticeshipFundingImport, options => options
                                           .Excluding(c => c.Standard)
                                           .Excluding(c => c.Id)
                                           .Excluding(c => c.LarsCode)
                                           );

            actual.StandardUId.Should().Be(standardUId);
        }
        protected override int GetFundingDetails(string prop)
        {
            if (ApprenticeshipFunding == null || ApprenticeshipFunding.Any() == false)
            {
                switch (prop)
                {
                case nameof(MaxFunding):
                    return(VersionDetail?.ProposedMaxFunding ?? 0);

                case nameof(TypicalDuration):
                    return(VersionDetail?.ProposedTypicalDuration ?? 0);
                }
            }

            return(base.GetFundingDetails(prop));
        }
Example #5
0
        private async Task <int> LoadApprenticeshipFunding()
        {
            var standardsTask = _standardImportRepository.GetAll();
            var apprenticeshipFundingImportsTask = _apprenticeshipFundingImportRepository.GetAll();

            await Task.WhenAll(standardsTask, apprenticeshipFundingImportsTask);

            var fundings = standardsTask.Result.Join(
                apprenticeshipFundingImportsTask.Result,
                standard => standard.LarsCode,
                funding => funding.LarsCode,
                (standard, apprenticeshipFundingImport) => ApprenticeshipFunding.ConvertFrom(apprenticeshipFundingImport, standard.StandardUId))
                           .ToList();

            _apprenticeshipFundingRepository.DeleteAll();

            var importApprenticeshipFundingResult = _apprenticeshipFundingRepository.InsertMany(fundings);

            return(fundings.Count());
        }