public async Task ImageControllerDeleteImageStatusCodeOnStorageErrors(HttpStatusCode statusCode)
        {
            imageStoreMock.Setup(store => store.DeleteImage(_imageId))
            .ThrowsAsync(new StorageErrorException("Test Exception", (int)statusCode));
            ChatServiceException e = await Assert.ThrowsAsync <ChatServiceException>(() => chatServiceClient.DeleteImage(_imageId));

            Assert.Equal(statusCode, e.StatusCode);
        }
예제 #2
0
        public async Task ProfileControllerDeleteProfileStatusCodeOnStorageErrors(HttpStatusCode statusCode)
        {
            profileStoreMock.Setup(store => store.DeleteProfile(_testUserProfile.Username))
            .ThrowsAsync(new StorageErrorException("Test Exception", (int)statusCode));
            ChatServiceException e = await Assert.ThrowsAsync <ChatServiceException>(() => chatServiceClient.DeleteProfile(_testUserProfile.Username));

            Assert.Equal(statusCode, e.StatusCode);
        }
예제 #3
0
        public async Task ConversationsControllerAddConversationStatusCodeOnStorageErrors(HttpStatusCode statusCode)
        {
            conversationStoreMock.Setup(store => store.AddConversation(_conversation))
            .ThrowsAsync(new StorageErrorException("Test Exception", (int)statusCode));

            ChatServiceException e = await Assert.ThrowsAsync <ChatServiceException>(() => chatServiceClient.AddConversation(_addConversationRequestBody));

            Assert.Equal(statusCode, e.StatusCode);
        }
예제 #4
0
        public async Task ConversationsControllerGetMessagesStatusCodeOnStorageErrors(HttpStatusCode statusCode)
        {
            messageStoreMock.Setup(store => store.GetMessages(_conversationId, null, 3, long.MinValue))
            .ThrowsAsync(new StorageErrorException("Test Exception", (int)statusCode));

            ChatServiceException e = await Assert.ThrowsAsync <ChatServiceException>(() => chatServiceClient.GetMessages(_conversationId, 3, Int64.MinValue));

            Assert.Equal(statusCode, e.StatusCode);
        }
        public async Task ImageControllerUploadImageStatusCodeOnStorageErrors(HttpStatusCode statusCode)
        {
            imageStoreMock.Setup(store => store.UploadImage(_imageBytes))
            .ThrowsAsync(new StorageErrorException("Test Exception", (int)statusCode));
            var stream             = new MemoryStream(_imageBytes);
            ChatServiceException e = await Assert.ThrowsAsync <ChatServiceException>(() => chatServiceClient.UploadImage(stream));

            Assert.Equal(statusCode, e.StatusCode);
        }