public void TestAddNewReportReturnBadRequest() { Report report = null; var reportController = new ReportController(_mockReportService.Object); var checkAddNewReport = reportController.AddNewReport(report); var type = checkAddNewReport.GetType(); Assert.AreEqual(type.Name, "BadRequestResult"); }
public void TestAddNewReportReturnOkObjectResult() { var contextMock = new Mock <HttpContext>(); contextMock.Setup(x => x.User).Returns(new ClaimsPrincipal(claims)); _mockReportService.Setup(x => x.Add(It.IsAny <Report>())).Returns(report); var reportController = new ReportController(_mockReportService.Object); reportController.ControllerContext.HttpContext = contextMock.Object; var checkAddNewReport = reportController.AddNewReport(report); var type = checkAddNewReport.GetType(); Assert.AreEqual(type.Name, "OkObjectResult"); }