public async Task GetInfiniteScroll_ReturnsNotContent_GivenNull() { // Arrange var mockRepo = new Mock <IServiceService <Service> >(); var returning = "invalid"; var dbMock = GetServices(null, returning); mockRepo.Setup(x => x.GetInfiniteScroll(It.IsAny <int>(), It.IsAny <int>())).Returns(dbMock); var controller = new ServicesController(mockRepo.Object); // Act var result = await controller.GetInfiniteScroll(1, 3); // Assert Assert.IsType <NoContentResult>(result); }
public async Task GetInfiniteScroll_ReturnsServiceDTO_GivenService() { // Arrange var mockRepo = new Mock <IServiceService <Service> >(); var dbMock = GetServices(CodeServiceUsersControllerTests.GetListSync()); mockRepo.Setup(x => x.GetInfiniteScroll(It.IsAny <int>(), It.IsAny <int>())).Returns(dbMock); var controller = new ServicesController(mockRepo.Object); // Act var result = await controller.GetInfiniteScroll(1, 3); // Assert var okResult = Assert.IsType <OkObjectResult>(result); var returnService = Assert.IsType <List <ServiceDTO> >(okResult.Value); Assert.Equal(3, returnService.Count); Assert.Equal("Test One", returnService.First().Name); }