public void GetCategoriesWithProductCount_Returns_Categories_With_Count_From_HttpResponseMessage()
        {
            var category1            = Fixture.Create <Category>();
            var category2            = Fixture.Create <Category>();
            var category3            = Fixture.Create <Category>();
            var expectedCategoryList = new List <Category>()
            {
                category1, category2, category3
            };

            var stringContent = new StringContent(JsonSerializer.Serialize(new DashboardResponse()
            {
                Results = expectedCategoryList
            }));

            var apiClientResponse = new HttpResponseMessage {
                StatusCode = HttpStatusCode.OK, Content = stringContent
            };

            var categoriesWithProductCountSql =
                "SELECT p.CategoryName, p.CategoryId, Count(S.CategoryId) AS ProductCount " +
                "FROM StockItem AS S " +
                "RIGHT JOIN ProductCategories AS P " +
                "ON P.CategoryId = S.CategoryId " +
                "GROUP BY P.CategoryId, P.CategoryName";

            _dashboardApiClient
            .Setup(x => x.ExecuteCustomScriptQuery(_sut.ControllerContext.HttpContext,
                                                   It.IsAny <CancellationToken>(),
                                                   categoriesWithProductCountSql))
            .Returns(Task.FromResult(apiClientResponse));

            var response = _sut.CategoriesWithProductCount(It.IsAny <CancellationToken>());

            var result = response.Result as JsonResult;

            var categories = result.Value as List <Category>;


            Assert.That(response, Is.Not.Null);
            Assert.That(result, Is.Not.Null);
            Assert.That(categories.Count, Is.EqualTo(expectedCategoryList.Count));
            Assert.That(categories[0].CategoryId, Is.EqualTo(expectedCategoryList[0].CategoryId));
            Assert.That(categories[1].CategoryName, Is.EqualTo(expectedCategoryList[1].CategoryName));
            Assert.That(categories[2].ProductCount, Is.EqualTo(expectedCategoryList[2].ProductCount));
            Assert.That(categories[0].ProductCount, Is.EqualTo(expectedCategoryList[0].ProductCount));
        }