public async void Update_NotFound() { PasswordControllerMockFacade mock = new PasswordControllerMockFacade(); var mockResult = new Mock <UpdateResponse <ApiPasswordResponseModel> >(); mockResult.SetupGet(x => x.Success).Returns(false); mock.ServiceMock.Setup(x => x.Update(It.IsAny <int>(), It.IsAny <ApiPasswordRequestModel>())).Returns(Task.FromResult <UpdateResponse <ApiPasswordResponseModel> >(mockResult.Object)); mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiPasswordResponseModel>(null)); PasswordController controller = new PasswordController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, new ApiPasswordModelMapper()); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); IActionResult response = await controller.Update(default(int), new ApiPasswordRequestModel()); response.Should().BeOfType <StatusCodeResult>(); (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound); mock.ServiceMock.Verify(x => x.Get(It.IsAny <int>())); }