protected TestSuiteDefinition GetTestSuiteDefinition(ConsoleMethod test)
        {
            TestSuiteDefinition suite = TestSuiteDefinition.FromMethod(test);

            if (!_testSuiteDefinitionLookupByTitle.TryGetValue(suite.Title, out TestSuiteDefinition fromCache))
            {
                GetSuiteDefinitionResponse response = TestReportService.GetSuiteDefinition(suite.Title);
                if (response.Success)
                {
                    _testSuiteDefinitionLookupByTitle.TryAdd(suite.Title, response.SuiteDefinition);
                }
                else
                {
                    Logger.Warning("Failed to define test suite: {0}", response.Message);
                }
            }
            if (fromCache != null)
            {
                suite = fromCache;
            }
            return(suite);
        }
        /// <summary>
        /// Get a TestSuiteDefinition for the specified test creating it if necessary
        /// and populating the internal cache
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        protected TestSuiteDefinition GetTestSuiteDefinition <TTestMethod>(TestEventArgs <TTestMethod> args) where TTestMethod : TestMethod
        {
            ConsoleMethod       test  = args.Test;
            TestSuiteDefinition suite = TestSuiteDefinition.FromTestEventArgs(args);

            if (!_testSuiteDefinitionLookupByTitle.TryGetValue(suite.Title, out TestSuiteDefinition fromCache))
            {
                GetSuiteDefinitionResponse response = TestReportService.GetSuiteDefinition(suite.Title);
                if (response.Success)
                {
                    _testSuiteDefinitionLookupByTitle.TryAdd(suite.Title, response.SuiteDefinition);
                }
                else
                {
                    Logger.Warning("Failed to define test suite: {0}", response.Message);
                }
            }
            if (fromCache != null)
            {
                suite = fromCache;
            }
            return(suite);
        }