public void Delete_WhenPaymentNotFound_Returns404NotFound() { _repositoryMock .Setup(r => r.Get(It.IsAny <string>())) .Returns(Task.FromResult <Payment>(null)); var response = _paymentsController.Delete("paymentId").Result as NotFoundResult; Assert.NotNull(response); Assert.Equal(404, response.StatusCode); }