public ProviderStandardImport Map(CourseStandard courseStandard, int ukprn)
 {
     return(new ProviderStandardImport
     {
         StandardId = courseStandard.StandardCode,
         Email = courseStandard.Contact.Email,
         Phone = courseStandard.Contact.Phone,
         ContactUrl = courseStandard.Contact.ContactUsUrl,
         StandardInfoUrl = courseStandard.StandardInfoUrl,
         Ukprn = ukprn
     });
 }
Exemple #2
0
        public async Task Then_The_National_Flag_Is_Populated_From_Location_And_Provider_Standard_Information(
            [Frozen] Mock <IProviderStandardImportRepository> providerStandardImportRepository,
            [Frozen] Mock <IProviderImportRepository> providerImportRepository,
            [Frozen] Mock <IProviderStandardLocationImportRepository> providerStandardLocationImportRepository,
            [Frozen] Mock <IStandardLocationImportRepository> standardLocationImportRepository,
            [Frozen] Mock <ICourseDirectoryService> service,
            long locationId,
            Domain.ImportTypes.Provider providerImport,
            CourseStandard standardImport,
            CourseLocation locationImport,
            ProviderCourseImportService providerCourseImportService)
        {
            //Arrange
            locationImport.Address.Lat  = 52.564269;
            locationImport.Address.Long = -1.466056;
            locationImport.Id           = locationId;
            standardImport.Locations    = new List <StandardLocation> {
                new StandardLocation
                {
                    Radius        = 500,
                    Id            = locationId,
                    DeliveryModes = new List <string> {
                        "100PercentEmployer"
                    }
                }
            };
            providerImport.Locations = new List <CourseLocation> {
                locationImport
            };
            providerImport.Standards = new List <CourseStandard> {
                standardImport
            };
            service.Setup(x => x.GetProviderCourseInformation()).ReturnsAsync(new List <Domain.ImportTypes.Provider> {
                providerImport
            });

            //Act
            await providerCourseImportService.ImportProviderCourses();

            //Assert
            providerStandardLocationImportRepository.Verify(x =>
                                                            x.InsertMany(It.Is <List <ProviderStandardLocationImport> >(c => c.TrueForAll(ps => ps.National))));
        }
Exemple #3
0
        public async Task Then_The_Distinct_ProviderStandards_Are_Loaded_Into_The_Import_Table(
            [Frozen] Mock <IProviderStandardImportRepository> providerStandardImportRepository,
            [Frozen] Mock <IProviderImportRepository> providerImportRepository,
            [Frozen] Mock <IProviderStandardLocationImportRepository> providerStandardLocationImportRepository,
            [Frozen] Mock <IStandardLocationImportRepository> standardLocationImportRepository,
            [Frozen] Mock <ICourseDirectoryService> service,
            List <Domain.ImportTypes.Provider> providerImport,
            CourseStandard courseStandard,
            ProviderCourseImportService providerCourseImportService
            )
        {
            //Arrange
            providerImport.FirstOrDefault().Standards.Add(courseStandard);
            providerImport.FirstOrDefault().Standards.Add(courseStandard);
            service.Setup(x => x.GetProviderCourseInformation()).ReturnsAsync(providerImport);

            //Act
            await providerCourseImportService.ImportProviderCourses();

            //Assert
            providerStandardImportRepository.Verify(x =>
                                                    x.InsertMany(It.Is <List <ProviderStandardImport> >(c =>
                                                                                                        c.Count.Equals(providerImport.Sum(d => d.Standards.Count) - 1))), Times.Once);
        }