public void GroupTestResults()
        {
            // Given
            TestApiClient apiClient   = new TestApiClient();
            LoggerQueue   loggerQueue = new LoggerQueue(apiClient, "987", "foo", "bar")
            {
                Source = "Fizz.Buzz"
            };

            ITestResult[] testResults = new[]
            {
                new TestTestResult
                {
                    FullyQualifiedName = "Fizz.Buzz.FooFixture.BarMethod"
                },
                new TestTestResult
                {
                    FullyQualifiedName = "Fizz.Buzz.FooFixture.BazMethod"
                },
                new TestTestResult
                {
                    FullyQualifiedName = "Fizz.Buzz.FutzFixture.BooMethod(\"x.y\")"
                },
                new TestTestResult
                {
                    FullyQualifiedName = "Fizz.Buzz.FutzFixture.NestedFixture.BlitzMethod"
                }
            };

            // When
            IEnumerable <IGrouping <string, ITestResult> > testResultsByParent = loggerQueue.GroupTestResultsByParent(testResults);

            // Then
            testResultsByParent.Select(x => x.Key).ShouldBe(
                new[]
            {
                "FooFixture",
                "FutzFixture",
                "FutzFixture.NestedFixture"
            },
                true);
        }
        public void CreateParents()
        {
            // Given
            TestApiClient apiClient = new TestApiClient(_ =>
                                                        @"{
                    ""count"": 2,
                    ""value"": [
                        {
                            ""id"": 100
                        },
                        {
                            ""id"": 101
                        }
                    ]
                }");
            LoggerQueue loggerQueue = new LoggerQueue(apiClient, "987", "foo", "bar")
            {
                Source          = "Fizz.Buzz",
                TestRunEndpoint = "/ep"
            };

            loggerQueue.Parents.Add("FitzFixture", new TestResultParent(123));
            ITestResult[] testResults = new[]
            {
                new TestTestResult
                {
                    FullyQualifiedName = "Fizz.Buzz.FooFixture.BarMethod"
                },
                new TestTestResult
                {
                    FullyQualifiedName = "Fizz.Buzz.FitzFixture.BazMethod"
                },
                new TestTestResult
                {
                    FullyQualifiedName = "Fizz.Buzz.FutzFixture.NestedFixture.BooMethod(\"x.y\")"
                }
            };
            IEnumerable <IGrouping <string, ITestResult> > testResultsByParent = loggerQueue.GroupTestResultsByParent(testResults);

            // When
            loggerQueue.CreateParents(testResultsByParent, CancellationToken.None).Wait();

            // Then
            apiClient.Messages.ShouldBe(new[]
            {
                new ClientMessage(
                    HttpMethod.Post,
                    "/ep",
                    "5.0-preview.5",
                    $@"[
                        {{
                            ""testCaseTitle"": ""FooFixture"",
                            ""automatedTestName"": ""FooFixture"",
                            ""resultGroupType"": ""generic"",
                            ""outcome"": ""Passed"",
                            ""state"": ""InProgress"",
                            ""startedDate"": ""{loggerQueue.Parents["FooFixture"].StartedDate.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ")}"",
                            ""automatedTestType"": ""UnitTest"",
                            ""automatedTestTypeId"": ""13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b"",
                            ""automatedTestStorage"": ""Fizz.Buzz""
                        }},
                        {{
                            ""testCaseTitle"": ""FutzFixture.NestedFixture"",
                            ""automatedTestName"": ""FutzFixture.NestedFixture"",
                            ""resultGroupType"": ""generic"",
                            ""outcome"": ""Passed"",
                            ""state"": ""InProgress"",
                            ""startedDate"": ""{loggerQueue.Parents["FutzFixture.NestedFixture"].StartedDate.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ")}"",
                            ""automatedTestType"": ""UnitTest"",
                            ""automatedTestTypeId"": ""13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b"",
                            ""automatedTestStorage"": ""Fizz.Buzz""
                        }}
                    ]")
            });
            loggerQueue.Parents.Keys.ShouldBe(new[] { "FitzFixture", "FooFixture", "FutzFixture.NestedFixture" }, true);
            loggerQueue.Parents.Values.Select(x => x.Id).ShouldBe(new[] { 123, 100, 101 }, true);
        }