public async Task WhenFamFailsToReturnEmailDefaultsToTheFallBack() { // arrange var routingDetailModel = new RoutingDetailModel() { EmailAddress = null, }; A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).Returns(routingDetailModel); var routingService = new RoutingService(FamApiRoutingOptions, fakeApiDataProcessorService, fakeHttpClient); // act var result = await routingService.GetEmailToSendTo(ValidPostcode, Category.AdviceGuidance).ConfigureAwait(false); // assert A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).MustHaveHappenedOnceExactly(); result.Should().Be(FamApiRoutingOptions.FallbackEmailToAddresses); }
public async Task ForAdviceAndCoursesGetsEmailFromFam(Category selectedCategory) { // arrange var routingDetailModel = new RoutingDetailModel() { EmailAddress = "areaEmail", }; A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).Returns(routingDetailModel); var routingService = new RoutingService(FamApiRoutingOptions, fakeApiDataProcessorService, fakeHttpClient); // act var result = await routingService.GetEmailToSendTo(ValidPostcode, selectedCategory).ConfigureAwait(false); // assert A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).MustHaveHappenedOnceExactly(); result.Should().Be(routingDetailModel.EmailAddress); }