public async Task ApproveLoanLoanEmailDetails_ApproveDataIsNull_Test() { var searchServiceMock = new Mock <ISearchService>().Object; var loanServiceMock = new Mock <ILoanService>().Object; var encodeDecodeServiceMock = new Mock <IEncodeDecodeService>().Object; var defaultContext = new DefaultHttpContext() { User = new ClaimsPrincipal() }; var controller = new LoanController(loanServiceMock, searchServiceMock, encodeDecodeServiceMock) { ControllerContext = new ControllerContext() { HttpContext = defaultContext } }; string approveData = null; var rejectData = "Test Data"; var result = await controller.ApproveLoan(approveData, rejectData); Assert.IsInstanceOfType(result, typeof(JsonResult)); }