public async Task GetAllWithStats_ShouldReturnOk() { // Arrange string sort = "name"; unitOfWorkMock.Setup(x => x.ServiceRepository.GetAllWithStatsAsync(sort)).ReturnsAsync(GetServicesWithStats()); // Act IHttpActionResult result = await controller.GetAllWithStats(sort); var contentResult = result as OkNegotiatedContentResult <List <ServiceStatsBindingModel> >; // Assert Assert.IsNotNull(contentResult); Assert.IsNotNull(contentResult.Content); Assert.AreEqual(contentResult.Content.Count(), GetServicesWithStats().Count); }