public async Task SendLogMessageAsync_Returns_InvalidOperationExceptionForEmptyMessages()
        {
            //Arrange
            var messages = new List <Message>()
            {
                //empty Message
            }.ToArray();

            var mockLogMessageManager = new Mock <ILogMessageService>();
            var manager = new LogMessageManager(mockLogMessageManager.Object);

            //Assert
            Assert.ThrowsAsync <InvalidOperationException>(async() => await manager.SendLogMessageAsync(messages), "Invalid message to send");
        }
        public async Task SendLogMessageAsync_ReturnsResponse_ForValidMessages()
        {
            //Arrange
            var fakeMessages = new List <Message>()
            {
                new Message
                {
                    Title = "Test message summary",
                    Text  = "Exceptiion occured at ..."
                }
            }.ToArray();

            var fakeLogMessageResponse = new LogMessageResponse
            {
                Records = new List <RecordResponse>()
                {
                    new RecordResponse
                    {
                        Id    = Guid.NewGuid().ToString(),
                        Field = new Field()
                        {
                            Id         = "recTPWgTQaKlETabD",
                            Message    = "Test message summary",
                            Summary    = "Exceptiion occured at ...",
                            ReceivedAt = DateTime.UtcNow
                        },

                        CreatedTime = DateTime.UtcNow
                    }
                }.ToArray()
            };

            var json = JsonConvert.SerializeObject(fakeLogMessageResponse);
            var mockLogMessageManager = new Mock <ILogMessageService>();

            mockLogMessageManager.Setup(x => x.SendLogsAsync(It.IsAny <LogMessageRequest>())).Returns(Task.FromResult(json));
            var manager = new LogMessageManager(mockLogMessageManager.Object);
            //Act
            var response = await manager.SendLogMessageAsync(fakeMessages);

            //Assert
            Assert.IsNotNull(response);
            mockLogMessageManager.Verify(s => s.SendLogsAsync(It.IsAny <LogMessageRequest>()), Times.Once);
        }