Esempio n. 1
0
        public void UnprocessableEntityObjectResult_SetsStatusCodeAndValue()
        {
            // Arrange & Act
            var obj    = new object();
            var result = new UnprocessableEntityObjectResult(obj);

            // Assert
            Assert.Equal(StatusCodes.Status422UnprocessableEntity, result.StatusCode);
            Assert.Equal(obj, result.Value);
        }
Esempio n. 2
0
        public void UnprocessableEntityObjectResult_ModelState_SetsStatusCodeAndValue()
        {
            // Arrange & Act
            var result = new UnprocessableEntityObjectResult(new ModelStateDictionary());

            // Assert
            Assert.Equal(StatusCodes.Status422UnprocessableEntity, result.StatusCode);
            var errors = Assert.IsType <SerializableError>(result.Value);

            Assert.Empty(errors);
        }