Beispiel #1
0
        public void PostConfigure_ConfiguresMaxValidationDepth()
        {
            // Arrange
            var mvcOptions = new MvcOptions();
            var mvcCompatibilityOptions = new MvcCompatibilityOptions
            {
                CompatibilityVersion = CompatibilityVersion.Version_3_0,
            };

            var configureOptions = new MvcOptionsConfigureCompatibilityOptions(
                NullLoggerFactory.Instance,
                Options.Create(mvcCompatibilityOptions));

            // Act
            configureOptions.PostConfigure(string.Empty, mvcOptions);

            // Assert
            Assert.Equal(32, mvcOptions.MaxValidationDepth);
        }
Beispiel #2
0
        public void PostConfigure_DoesNotConfiguresMaxValidationDepth_WhenSetToNull()
        {
            // Arrange
            var mvcOptions = new MvcOptions
            {
                MaxValidationDepth = null,
            };
            var mvcCompatibilityOptions = new MvcCompatibilityOptions
            {
                CompatibilityVersion = CompatibilityVersion.Version_3_0,
            };

            var configureOptions = new MvcOptionsConfigureCompatibilityOptions(
                NullLoggerFactory.Instance,
                Options.Create(mvcCompatibilityOptions));

            // Act
            configureOptions.PostConfigure(string.Empty, mvcOptions);

            // Assert
            Assert.Null(mvcOptions.MaxValidationDepth);
        }
Beispiel #3
0
        public void PostConfigure_DoesNotConfiguresMaxValidationDepth_WhenSetToValue()
        {
            // Arrange
            var expected   = 13;
            var mvcOptions = new MvcOptions
            {
                MaxValidationDepth = expected,
            };
            var mvcCompatibilityOptions = new MvcCompatibilityOptions
            {
                CompatibilityVersion = CompatibilityVersion.Version_2_2,
            };

            var configureOptions = new MvcOptionsConfigureCompatibilityOptions(
                NullLoggerFactory.Instance,
                Options.Create(mvcCompatibilityOptions));

            // Act
            configureOptions.PostConfigure(string.Empty, mvcOptions);

            // Assert
            Assert.Equal(expected, mvcOptions.MaxValidationDepth);
        }