public async Task Initialize_NoSubmission_DoesNotPopulateApprenticeshipFields() { // Arrange var marketingInfo = "example marketing information"; var provider = await TestData.CreateProvider( providerName : "Provider 1", apprenticeshipQAStatus : ApprenticeshipQAStatus.Submitted, marketingInformation : marketingInfo); var standardsAndFrameworksCache = new StandardsCache(CosmosDbQueryDispatcher.Object); await WithSqlQueryDispatcher(async dispatcher => { var initializer = new FlowModelInitializer(CosmosDbQueryDispatcher.Object, dispatcher); // Act var model = await initializer.Initialize(provider.ProviderId); // Assert Assert.False(model.GotApprenticeshipDetails); Assert.Null(model.ApprenticeshipContactEmail); Assert.Null(model.ApprenticeshipContactTelephone); Assert.Null(model.ApprenticeshipContactWebsite); Assert.Null(model.ApprenticeshipId); Assert.Null(model.ApprenticeshipIsNational); Assert.Null(model.ApprenticeshipLocationType); Assert.Null(model.ApprenticeshipMarketingInformation); Assert.Null(model.ApprenticeshipClassroomLocations); Assert.Null(model.ApprenticeshipLocationSubRegionIds); Assert.Null(model.ApprenticeshipWebsite); }); }
public async Task Initialize_NationalApprenticeship_PopulatesModelCorrectly() { // Arrange var contactTelephone = "1111 111 1111"; var website = "https://somerandomprovider.com/apprenticeship"; var contactWebsite = "https://somerandomprovider.com"; var marketingInfo = "Providing Online training"; var regions = new List <string> { "123" }; var contactEmail = "*****@*****.**"; var provider = await TestData.CreateProvider( providerName : "Provider 1", apprenticeshipQAStatus : ApprenticeshipQAStatus.Submitted); var providerUser = await TestData.CreateUser(providerId : provider.ProviderId); var adminUser = await TestData.CreateUser(); var standard = await TestData.CreateStandard(standardCode : 1234, version : 1, standardName : "Test Standard"); var apprenticeshipId = (await TestData.CreateApprenticeship(provider.ProviderId, standard, createdBy: providerUser, contactEmail: contactEmail, contactTelephone: contactTelephone, contactWebsite: contactWebsite, marketingInformation: marketingInfo, website: website, locations: new[] { CreateApprenticeshipLocation.CreateNationalEmployerBased() })).ApprenticeshipId; var standardsAndFrameworksCache = new StandardsCache(CosmosDbQueryDispatcher.Object); var submissionId = await TestData.CreateApprenticeshipQASubmission( provider.ProviderId, submittedOn : Clock.UtcNow, submittedByUserId : providerUser.UserId, providerMarketingInformation : "The overview", apprenticeshipIds : new[] { apprenticeshipId }); await WithSqlQueryDispatcher(async dispatcher => { var initializer = new FlowModelInitializer(CosmosDbQueryDispatcher.Object, dispatcher); // Act var model = await initializer.Initialize(provider.ProviderId); // Assert Assert.True(model.GotApprenticeshipDetails); Assert.Equal(contactEmail, model.ApprenticeshipContactEmail); Assert.Equal(contactTelephone, model.ApprenticeshipContactTelephone); Assert.Equal(contactWebsite, model.ApprenticeshipContactWebsite); Assert.Equal(apprenticeshipId, model.ApprenticeshipId); Assert.True(model.ApprenticeshipIsNational); Assert.Equal(ApprenticeshipLocationType.EmployerBased, model.ApprenticeshipLocationType); Assert.Equal(marketingInfo, model.ApprenticeshipMarketingInformation); Assert.Null(model.ApprenticeshipClassroomLocations); Assert.Equal(website, model.ApprenticeshipWebsite); }); }