public async void DriversController_GetAllFilter_Valid() { // Arrange var mockDriver = MockDriverData.GetEmptyModelListAsync(); DriversResourceParameters parameters = new DriversResourceParameters { Name = "Niki" }; var mockDriverService = new MockDriverService().MockGetAll(mockDriver); var mockLogging = new Mock <ILogger <DriversController> >(); var controller = new DriversController(mockDriverService.Object, mockLogging.Object); // Act var result = await controller.Get(parameters); // Assert Assert.IsAssignableFrom <IActionResult>(result); mockDriverService.VerifyGetAll(Times.Once()); }
public async void DriversController_GetAll_Empty() { // Arrange var mockDriver = MockDriverData.GetEmptyModelListAsync(); DriversResourceParameters parameters = new DriversResourceParameters { }; var mockDriverService = new MockDriverService().MockGetAll(mockDriver); var mockLogging = new Mock <ILogger <DriversController> >(); var controller = new DriversController(mockDriverService.Object, mockLogging.Object); // Act var result = await controller.Get(parameters); // Assert var okResult = result.Should().BeOfType <OkObjectResult>().Subject; var Driver = okResult.Value.Should().BeAssignableTo <IEnumerable <DriverDto> >().Subject; Driver.Count().Should().Be(0); mockDriverService.VerifyGetAll(Times.Once()); }