private void HandleSuiteStart(string category, AllureTestResult testResult)
        {
            mCategoryToStartTimeMap.Add(category, testResult.StartTime);
            mCategoryToEndTimeMap.Add(category, testResult.EndTime);

            Allure.Lifecycle.Fire(new TestSuiteStartedWithTimeEvent(mCategoryToIdMap[category].ToString(), category, testResult.StartTime));
        }
        private void UpdateCategoryEndTime(string category, AllureTestResult testResult)
        {
            DateTimeOffset oldDateTimeOffset = mCategoryToEndTimeMap[category];

            if (oldDateTimeOffset < testResult.EndTime)
            {
                oldDateTimeOffset = testResult.EndTime;
                mCategoryToEndTimeMap[category] = oldDateTimeOffset;
            }
        }
        void TestResult(object sender, TestResultEventArgs e)
        {
            TestResult testResult = e.Result;

            MethodInfo methodInfo = GetTestMethodInfo(testResult);

            /*
             * Console.WriteLine("1: " + e.Result.DisplayName);
             * Console.WriteLine("2: " + String.Join(",", e.Result.Properties.Select(x => x.ToString())));
             * Console.WriteLine("3: " + e.Result.TestCase.DisplayName);
             * Console.WriteLine("4: " + String.Join(",", e.Result.TestCase.Properties.Select(x => x.ToString())));
             * Console.WriteLine("4: " + e.Result.TestCase.FullyQualifiedName);
             * Console.WriteLine("5: " + String.Join(",", e.Result.TestCase.Traits.Select(x => x.Name + ":" + x.Value)));
             */

            string description = GetDescription(methodInfo);
            IEnumerable <string> categories = GetCategories(methodInfo);

            if (!categories.Any())
            {
                categories = new string[] { String.Empty };
            }

            AllureTestResult allureTestResult = new AllureTestResult(testResult, categories, description);

            foreach (string category in categories)
            {
                mTestResultMap.Add(category, allureTestResult);

                if (!mCategoryToIdMap.ContainsKey(category))
                {
                    mCategoryToIdMap.Add(category, Guid.NewGuid());
                }

                if (!mCategoryToStartTimeMap.ContainsKey(category))
                {
                    HandleSuiteStart(category, allureTestResult);
                }
                else
                {
                    UpdateCategoryEndTime(category, allureTestResult);
                }

                HandleTestStart(category, allureTestResult);

                if (allureTestResult.Outcome == TestOutcome.Failed)
                {
                    HandleTestFaile(allureTestResult);
                }

                HandleTestEnd(allureTestResult);
            }
        }
 private void HandleTestEnd(AllureTestResult testResult)
 {
     Allure.Lifecycle.Fire(new TestCaseFinishedWithTimeEvent(testResult.EndTime));
 }
 private void HandleTestStart(string category, AllureTestResult testResult)
 {
     Allure.Lifecycle.Fire(new TestCaseStartedWithTimeEvent(mCategoryToIdMap[category].ToString(), testResult.Name, testResult.EndTime));
 }
 private void HandleTestFaile(AllureTestResult testResult)
 {
     Allure.Lifecycle.Fire(new TestCaseFailureWithErrorInfoEvent(testResult.ErrorMessage, testResult.StackTrace));
 }