public void SuiteFinished(TestResult result)
        {
            var requestFinishSuite = new FinishTestItemRequest
            {
                EndTime = result.EndTime.UtcDateTime,
                Status  = _statusMap[result.Outcome]
            };

            _suiteId.Finish(requestFinishSuite);
        }
        public void TestFinished(TestResult result)
        {
            if (_testId != null)
            {
                foreach (var message in result.Messages)
                {
                    foreach (var line in message.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
                    {
                        var handled = false;

                        try
                        {
                            var sharedMessage = Client.Converters.ModelSerializer.Deserialize <SharedLogMessage>(line);

                            var logRequest = new AddLogItemRequest
                            {
                                Level      = sharedMessage.Level,
                                Time       = sharedMessage.Time,
                                TestItemId = sharedMessage.TestItemId,
                                Text       = sharedMessage.Text
                            };
                            if (sharedMessage.Attach != null)
                            {
                                logRequest.Attach = new Attach
                                {
                                    Name     = sharedMessage.Attach.Name,
                                    MimeType = sharedMessage.Attach.MimeType,
                                    Data     = sharedMessage.Attach.Data
                                };
                            }

                            _testId.Log(logRequest);

                            handled = true;
                        }
                        catch (Exception)
                        {
                        }

                        if (!handled)
                        {
                            _testId.Log(new AddLogItemRequest
                            {
                                Time  = DateTime.UtcNow,
                                Level = LogLevel.Info,
                                Text  = line
                            });
                        }
                    }
                }

                if (result.ErrorMessage != null)
                {
                    _testId.Log(new AddLogItemRequest
                    {
                        Time  = result.EndTime.UtcDateTime,
                        Level = LogLevel.Error,
                        Text  = result.ErrorMessage + "\n" + result.ErrorStackTrace
                    });
                }

                if (result.Attachments != null)
                {
                    foreach (var attachmentSet in result.Attachments)
                    {
                        foreach (var attachmentData in attachmentSet.Attachments)
                        {
                            var filePath = attachmentData.Uri.AbsolutePath;

                            if (File.Exists(filePath))
                            {
                                var fileExtension = Path.GetExtension(filePath);

                                _testId.Log(new AddLogItemRequest
                                {
                                    Level  = LogLevel.Info,
                                    Text   = Path.GetFileName(filePath),
                                    Time   = result.EndTime.UtcDateTime,
                                    Attach = new Attach(Path.GetFileName(filePath), Shared.MimeTypes.MimeTypeMap.GetMimeType(fileExtension), File.ReadAllBytes(filePath))
                                });
                            }
                            else
                            {
                                _testId.Log(new AddLogItemRequest
                                {
                                    Level = LogLevel.Warning,
                                    Text  = $"'{filePath}' file is not available.",
                                    Time  = result.EndTime.UtcDateTime,
                                });
                            }
                        }
                    }
                }

                var description       = result.TestCase.Traits.FirstOrDefault(x => x.Name == "Description");
                var requestUpdateTest = new UpdateTestItemRequest
                {
                    Description = description != null ? description.Value : String.Empty,
                    Tags        = result.TestCase.Traits.Where(t => t.Name.ToLower() == "Category".ToLower()).Select(x => x.Value).ToList()
                };
                _testId.Update(requestUpdateTest);

                var requestFinishTest = new FinishTestItemRequest
                {
                    EndTime = result.EndTime.UtcDateTime,
                    Status  = _statusMap[result.Outcome]
                };
                _testId.Finish(requestFinishTest);
            }
        }