public async Task GetServiceStatusExceptionAsync()
        {
          
            //Fake set up incorrectly to cause exception
            A.CallTo(() => fakeGovUkNotifyClient.SendEmail(A<string>._, A<string>._, A<string>._, A<Dictionary<string, dynamic>>._)).Throws<NotifyClientException>();
           
            //Act
            var govUkNotifyService = new GovUkNotifyService(fakeApplicationLogger, fakeGovUkNotifyClient);
            var serviceStatus = await govUkNotifyService.GetCurrentStatusAsync();
           

            //Asserts
            serviceStatus.Status.Should().NotBe(ServiceState.Green);
        }
Example #2
0
        public async Task GetServiceStatusAsync(string responseId, ServiceState expectedServiceStatus)
        {
            //Fakes
            var emailResponse = responseId == null ? null : new Notify.Models.Responses.EmailNotificationResponse
            {
                id = responseId
            };

            A.CallTo(() => fakeGovUkNotifyClient.SendEmail(A <string> ._, A <string> ._, A <string> ._, A <Dictionary <string, dynamic> > ._)).Returns(emailResponse);

            //Act
            var govUkNotifyService = new GovUkNotifyService(fakeApplicationLogger, fakeGovUkNotifyClient);
            var serviceStatus      = await govUkNotifyService.GetCurrentStatusAsync();

            //Assert
            serviceStatus.Status.Should().Be(expectedServiceStatus);
        }