Ejemplo n.º 1
0
        public void SkipStatusCodePagesAttribute_Does_Not_Throw_If_Feature_Missing()
        {
            // Arrange
            var skipStatusCodeAttribute  = new SkipStatusCodePagesAttribute();
            var resourceExecutingContext = CreateResourceExecutingContext(new IFilterMetadata[] { skipStatusCodeAttribute });

            // Act
            skipStatusCodeAttribute.OnResourceExecuting(resourceExecutingContext);
        }
        public void SkipStatusCodePagesAttribute_Does_Not_Throw_If_Feature_Missing()
        {
            // Arrange
            var skipStatusCodeAttribute = new SkipStatusCodePagesAttribute();
            var resourceExecutingContext = CreateResourceExecutingContext(new IFilterMetadata[] { skipStatusCodeAttribute });

            // Act
            skipStatusCodeAttribute.OnResourceExecuting(resourceExecutingContext);
        }
        public void SkipStatusCodePagesAttribute_TurnsOfStatusCodePages()
        {
            // Arrange
            var skipStatusCodeAttribute = new SkipStatusCodePagesAttribute();
            var resourceExecutingContext = CreateResourceExecutingContext(new IFilterMetadata[] { skipStatusCodeAttribute });
            var statusCodePagesFeature = new TestStatusCodeFeature();
            resourceExecutingContext.HttpContext.Features.Set<IStatusCodePagesFeature>(statusCodePagesFeature);

            // Act
            skipStatusCodeAttribute.OnResourceExecuting(resourceExecutingContext);

            // Assert
            Assert.False(statusCodePagesFeature.Enabled);
        }
Ejemplo n.º 4
0
        public void SkipStatusCodePagesAttribute_TurnsOfStatusCodePages()
        {
            // Arrange
            var skipStatusCodeAttribute  = new SkipStatusCodePagesAttribute();
            var resourceExecutingContext = CreateResourceExecutingContext(new IFilterMetadata[] { skipStatusCodeAttribute });
            var statusCodePagesFeature   = new TestStatusCodeFeature();

            resourceExecutingContext.HttpContext.SetFeature <IStatusCodePagesFeature>(statusCodePagesFeature);

            // Act
            skipStatusCodeAttribute.OnResourceExecuting(resourceExecutingContext);

            // Assert
            Assert.False(statusCodePagesFeature.Enabled);
        }