Ejemplo n.º 1
0
        public void InternalServerError(ResultCode value)
        {
            // arrange
            var expected = StatusCodes.Status500InternalServerError;
            var sut      = new ErrorCodeConverter();

            // act
            var result      = sut.Convert(value);
            var codedResult = result as StatusCodeResult;

            // assert
            Assert.Equal(expected, codedResult.StatusCode);
        }
Ejemplo n.º 2
0
        public void NotFound()
        {
            // arrange
            var payload = ResultCode.NotFound;
            var sut     = new ErrorCodeConverter();

            // act
            var result         = sut.Convert(payload);
            var notFoundResult = result as NotFoundResult;

            // assert
            Assert.NotNull(notFoundResult);
        }
Ejemplo n.º 3
0
        public void BadRequest()
        {
            // arrange
            var payload  = ResultCode.BadRequest;
            var expected = StatusCodes.Status400BadRequest;
            var sut      = new ErrorCodeConverter();

            // act
            var result         = sut.Convert(payload);
            var conflictResult = result as StatusCodeResult;

            // assert
            Assert.Equal(expected, conflictResult.StatusCode);
        }
Ejemplo n.º 4
0
        public void Unauthorized()
        {
            // arrange
            var payload  = ResultCode.Unauthorized;
            var expected = StatusCodes.Status401Unauthorized;
            var sut      = new ErrorCodeConverter();

            // act
            var result         = sut.Convert(payload);
            var conflictResult = result as StatusCodeResult;

            // assert
            Assert.Equal(expected, conflictResult.StatusCode);
        }