Example #1
0
        public void TestResponseAssertsFalseForInvalidErrorId()
        {
            //--Arrange
            var actionResult =
                new RidgidApiController().HttpGenericErrorResponse(1, "ErrorMessage", HttpStatusCode.BadRequest);


            var expectedResult = new ErrorsResponse
            {
                Errors = new List <ErrorMessage>
                {
                    new ErrorMessage
                    {
                        ErrorId           = 2,
                        DebugErrorMessage = "ErrorMessage"
                    }
                }
            };

            //--Act/Assert
            Should.Throw <ShouldAssertException>(() => actionResult.BetterBe(HttpStatusCode.BadRequest, expectedResult));
        }
Example #2
0
        public void TestResponseAssertsTrueForValidErrorMessage()
        {
            //--Arrange
            var actionResult =
                new RidgidApiController().HttpGenericErrorResponse(1, "ErrorMessage", HttpStatusCode.BadRequest);


            var expectedResult = new ErrorsResponse
            {
                Errors = new List <ErrorMessage>
                {
                    new ErrorMessage
                    {
                        ErrorId           = 1,
                        DebugErrorMessage = "ErrorMessage"
                    }
                }
            };

            //--Act/Assert
            actionResult.BetterBe(HttpStatusCode.BadRequest, expectedResult);
        }