Пример #1
0
 public void GivenAnError_ThenAJSONViewResultIsreturned()
 {
     var controller = new TestableBaseController(_logger.Object);
     SetControllerContext(controller);
     var error = controller.JsonError(new Exception(), new ErrorCode(), "");
     error.Should().BeOfType<JsonResult>();
 }
Пример #2
0
 public void GivenAnError_ThenTheJSONViewResultContainsTheCorrectData()
 {
     var controller = new TestableBaseController(_logger.Object);
     SetControllerContext(controller);
     const ErrorCode code = new ErrorCode();
     var ex = new Exception("error message");
     var error = controller.JsonError(ex, code, "message");
     error.As<JsonResult>().Data.As<ErrorViewModel>().DisplayMessage.Should().Be("message");
     error.As<JsonResult>().Data.As<ErrorViewModel>().ErrorCode.Should().Be(code);
     error.As<JsonResult>().Data.As<ErrorViewModel>().ErrorMessage.Should().Be("error message");
 }