public async Task RemovePersonAsync_WithMissingInput_ReturnsBadRequest() { var mockLogger = Mock.Of <ILogger <MaintenanceController> >(); var mockFaceClientService = Mock.Of <IFaceClientService>(); var controller = new MaintenanceController(mockFaceClientService, mockLogger); var actionResult = await controller.RemovePersonAsync(null); Assert.NotNull(actionResult); Assert.IsAssignableFrom <BadRequestResult>(actionResult); }
public async Task RemovePersonAsync_WithFaceClientServiceFault_ThrowsException() { var mockLogger = Mock.Of <ILogger <MaintenanceController> >(); var mockFaceClientService = new Mock <IFaceClientService>(); mockFaceClientService .Setup(service => service.DeletePersonAsync(It.IsNotNull <string>())) .Throws <NotImplementedException>(); var controller = new MaintenanceController(mockFaceClientService.Object, mockLogger); await Assert.ThrowsAsync <NotImplementedException>(async() => { await controller.RemovePersonAsync($"{Guid.NewGuid()}"); }); }
public async Task RemovePersonAsync_WithCorrectInput_ReturnsOk() { var mockLogger = Mock.Of <ILogger <MaintenanceController> >(); var mockFaceClientService = new Mock <IFaceClientService>(); mockFaceClientService .Setup(service => service.DeletePersonAsync(It.IsNotNull <string>())); var controller = new MaintenanceController(mockFaceClientService.Object, mockLogger); var actionResult = await controller.RemovePersonAsync($"{Guid.NewGuid()}"); Assert.NotNull(actionResult); Assert.IsAssignableFrom <NoContentResult>(actionResult); }