Ejemplo n.º 1
0
        public void Constructor_SetsStatusCode()
        {
            // Act
            ForbiddenAction action = new ForbiddenAction();

            // Assert
            Assert.AreEqual(HttpStatusCode.Forbidden, action.StatusCode);
        }
Ejemplo n.º 2
0
        public void Constructor_SetsStatusCode()
        {
            // Act
            ForbiddenAction action = new ForbiddenAction();

            // Assert
            Assert.AreEqual(HttpStatusCode.Forbidden, action.StatusCode);
        }
Ejemplo n.º 3
0
        public void Execute_WithNullContext_Throws()
        {
            // Arrange
            ForbiddenAction action  = new ForbiddenAction();
            IRewriteContext context = null;

            // Act/Assert
            ExceptionAssert.Throws <ArgumentNullException>(() => action.Execute(context));
        }
Ejemplo n.º 4
0
        public void Execute_WithNullContext_Throws()
        {
            // Arrange
            ForbiddenAction action = new ForbiddenAction();
            IRewriteContext context = null;

            // Act/Assert
            ExceptionAssert.Throws<ArgumentNullException>(() => action.Execute(context));
        }
Ejemplo n.º 5
0
    public void Forbidden_Verify403IsInStatusCode()
    {
        var context = new RewriteContext {
            HttpContext = new DefaultHttpContext()
        };
        var action = new ForbiddenAction();

        action.ApplyAction(context, null, null);

        Assert.Equal(RuleResult.EndResponse, context.Result);
        Assert.Equal(StatusCodes.Status403Forbidden, context.HttpContext.Response.StatusCode);
    }
Ejemplo n.º 6
0
        public void Execute_SetsStatusCode_ReturnsStopProcessing()
        {
            // Arrange
            ForbiddenAction action  = new ForbiddenAction();
            IRewriteContext context = new MockRewriteContext();

            // Act
            RewriteProcessing result = action.Execute(context);

            // Assert
            Assert.AreEqual(HttpStatusCode.Forbidden, context.StatusCode);
            Assert.AreEqual(RewriteProcessing.StopProcessing, result);
        }
Ejemplo n.º 7
0
        public void Execute_SetsStatusCode_ReturnsStopProcessing()
        {
            // Arrange
            ForbiddenAction action = new ForbiddenAction();
            IRewriteContext context = new MockRewriteContext();

            // Act
            RewriteProcessing result = action.Execute(context);

            // Assert
            Assert.AreEqual(HttpStatusCode.Forbidden, context.StatusCode);
            Assert.AreEqual(RewriteProcessing.StopProcessing, result);
        }