public void UnsupportedCategoryCauseException()
        {
            // arrange
            var routingService = new RoutingService(FamApiRoutingOptions, fakeApiDataProcessorService, fakeHttpClient);

            // act
            Func <Task> act = async() => await routingService.GetEmailToSendTo(ValidPostcode, Category.None).ConfigureAwait(false);

            // assert
            act.Should().Throw <InvalidEnumArgumentException>();
        }
        public async Task ForDirectCategoriesReturnsCorrrectEmail(Category selectedCategory, string expectedEmail)
        {
            // arrange
            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)).MustNotHaveHappened();
            result.Should().Be(expectedEmail);
        }
        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);
        }