public async Task GetMessageListReturns500WhenExceptionIsNotKnown()
        {
            var conversationsServiceMock = new Mock <IConversationsService>();

            conversationsServiceMock.Setup(store => store.GetMessageList(_testConversation.Id, _testContinuationToken, _testLimit, _lastSeenTime)).ThrowsAsync(new Exception("Test Exception"));

            var           loggerStub = new ConversationsControllerLoggerStub();
            var           controller = new ConversationsController(conversationsServiceMock.Object, loggerStub, new TelemetryClient());
            IActionResult result     = await controller.GetMessageList(_testConversation.Id, _testContinuationToken, _testLimit, _lastSeenTime);

            AssertUtils.HasStatusCode(HttpStatusCode.InternalServerError, result);
            Assert.Contains(LogLevel.Error, loggerStub.LogEntries.Select(entry => entry.Level));
        }
        public async Task PostMessageReturns503WhenStorageIsDown()
        {
            var conversationsServiceMock = new Mock <IConversationsService>();

            conversationsServiceMock.Setup(store => store.PostMessage(_testConversation.Id, _testPostMessageRequest)).ThrowsAsync(new StorageErrorException());

            var           loggerStub = new ConversationsControllerLoggerStub();
            var           controller = new ConversationsController(conversationsServiceMock.Object, loggerStub, new TelemetryClient());
            IActionResult result     = await controller.PostMessage(_testConversation.Id, _testPostMessageRequest);

            AssertUtils.HasStatusCode(HttpStatusCode.ServiceUnavailable, result);
            Assert.Contains(LogLevel.Error, loggerStub.LogEntries.Select(entry => entry.Level));
        }
        public async Task GetConversationsReturns503WhenStorageIsDown()
        {
            var conversationsServiceMock = new Mock <IConversationsService>();

            conversationsServiceMock.Setup(store => store.GetConversations(_testUsername, _testContinuationToken, _testLimit, _lastSeenTime)).ThrowsAsync(new StorageErrorException());

            var           loggerStub = new ConversationsControllerLoggerStub();
            var           controller = new ConversationsController(conversationsServiceMock.Object, loggerStub, new TelemetryClient());
            IActionResult result     = await controller.GetConversations(_testUsername, _testContinuationToken, _testLimit, _lastSeenTime);

            AssertUtils.HasStatusCode(HttpStatusCode.ServiceUnavailable, result);
            Assert.Contains(LogLevel.Error, loggerStub.LogEntries.Select(entry => entry.Level));
        }