public void EnrichmentDataSurvivesDeleteAndRecreate() { const string aboutCourseText = "About Course Text"; // Arrange var enrichmentService = new EnrichmentService(Context); var dataService = new DataService(Context, enrichmentService, new Mock <ILogger <DataService> >().Object); var sourceModel = new CourseEnrichmentModel { AboutCourse = aboutCourseText, }; enrichmentService.SaveCourseEnrichment(sourceModel, _ucasInstitution.ProviderCode, UcasCourseCode, Email); // Act var ucasPayload = new UcasPayload { // todo: test with change of this institution: https://trello.com/c/e1FwXuYk/133-ucas-institutions-dont-get-updated-during-ucas-import Institutions = new List <UcasInstitution> { new UcasInstitution { InstCode = _ucasInstitution.ProviderCode, InstFull = "Rebranded Provider", }, new UcasInstitution { InstCode = AccreditingInstCode, InstFull = "Rebranded Accrediting Provider", }, }, Courses = new List <UcasCourse> { new UcasCourse { InstCode = _ucasInstitution.ProviderCode, CrseCode = "CC11", AccreditingProvider = AccreditingInstCode, }, }, }; new UcasDataMigrator(Context, new Mock <Serilog.ILogger>().Object, ucasPayload).UpdateUcasData(); // Assert var res = enrichmentService.GetCourseEnrichment(_ucasInstitution.ProviderCode, UcasCourseCode, Email); res.EnrichmentModel.AboutCourse.Should().Be(sourceModel.AboutCourse); }
public PayloadBuilder() { _payload = new UcasPayload(); }
private void DoImport(UcasPayload ucasPayload) { new UcasDataMigrator(Context, new Mock <Serilog.ILogger>().Object, ucasPayload).UpdateUcasData(); }
public void EnrichmentDataSurvivesDeleteAndRecreate() { // Arrange var enrichmentService = new EnrichmentService(Context); var dataService = new DataService(Context, enrichmentService, new Mock <ILogger <DataService> >().Object); var sourceModel = new UcasProviderEnrichmentPostModel { EnrichmentModel = new ProviderEnrichmentModel { TrainWithUs = "Oh the grand old Duke of York", TrainWithDisability = "He had 10,000 men", AccreditingProviderEnrichments = new List <AccreditingProviderEnrichment> { new AccreditingProviderEnrichment { UcasProviderCode = AccreditingInstCode, Description = "He marched them up to the top of the hill" } } }, }; enrichmentService.SaveProviderEnrichment(sourceModel, _ucasInstitution.ProviderCode, Email); // Act var ucasPayload = new UcasPayload { // todo: test with change of this institution: https://trello.com/c/e1FwXuYk/133-ucas-institutions-dont-get-updated-during-ucas-import Institutions = new List <UcasInstitution> { new UcasInstitution { InstCode = _ucasInstitution.ProviderCode, InstName = "Rebranded Provider", }, new UcasInstitution { InstCode = AccreditingInstCode, InstName = "Rebranded Accrediting Provider", }, }, Courses = new List <UcasCourse> { new UcasCourse { InstCode = _ucasInstitution.ProviderCode, CrseCode = "CC11", AccreditingProvider = AccreditingInstCode, }, }, }; new UcasDataMigrator(Context, new Mock <Serilog.ILogger>().Object, ucasPayload).UpdateUcasData(); // Assert var res = enrichmentService.GetProviderEnrichment(_ucasInstitution.ProviderCode, Email); res.EnrichmentModel.TrainWithUs.Should().Be(sourceModel.EnrichmentModel.TrainWithUs); res.EnrichmentModel.TrainWithDisability.Should().Be(sourceModel.EnrichmentModel.TrainWithDisability); res.EnrichmentModel.AccreditingProviderEnrichments.Should().HaveCount(1); res.EnrichmentModel.AccreditingProviderEnrichments.Should().HaveSameCount(sourceModel.EnrichmentModel.AccreditingProviderEnrichments); res.EnrichmentModel.AccreditingProviderEnrichments[0].Description.Should().Be(sourceModel.EnrichmentModel.AccreditingProviderEnrichments[0].Description); res.EnrichmentModel.AccreditingProviderEnrichments[0].UcasProviderCode.Should().Be(sourceModel.EnrichmentModel.AccreditingProviderEnrichments[0].UcasProviderCode); }