public void should_receive_request_and_send_response() { // Arrange MediatorMock .Setup(i => i.Send(It.IsAny <EmployeeReadQuery>(), default(CancellationToken))) .ReturnsAsync(AnyEmployeeResponse); // Act var result = EmployeeControllerUnderTest.Read(AnyEmployeeResponse.EmployeeId).Result; // Assert Assert.IsType <OkObjectResult>(result); }
public void should_receive_request_and_delete_request() { // Arrange MediatorMock .Setup(i => i.Send(It.IsAny <EmployeeDeleteCommand>(), default(CancellationToken))) .ReturnsAsync(Unit.Value); // Act var result = EmployeeControllerUnderTest.Delete(AnyEmployeeResponse.EmployeeId).Result; // Assert Assert.IsType <OkResult>(result); }
public void should_receive_request_and_update_employee() { // Arrange EmployeeRequest inputRequest = new EmployeeRequest() { Name = "joe", Address = "waterloo", Email = "*****@*****.**" }; MediatorMock .Setup(i => i.Send(It.IsAny <EmployeeUpdateCommand>(), default(CancellationToken))) .ReturnsAsync(Unit.Value); // Act var result = EmployeeControllerUnderTest.Update(AnyEmployeeResponse.EmployeeId, inputRequest).Result; // Assert Assert.IsType <OkResult>(result); }
public void should_receive_request_to_create_employee() { // Arrange var inputRequest = new EmployeeRequest() { Name = "joe", Address = "wellington", Email = "*****@*****.**" }; MediatorMock .Setup(i => i.Send(It.IsAny <EmployeeCreateCommand>(), default(CancellationToken))) .ReturnsAsync(employeeCommand); // Act var result = EmployeeControllerUnderTest.Create(inputRequest).Result; // Assert Assert.IsType <CreatedResult>(result); }