示例#1
0
        public void Execute_WithNullContext_Throws()
        {
            // Arrange
            string          header  = "HeaderName";
            string          value   = "HeaderValue";
            IRewriteContext context = null;
            AddHeaderAction action  = new AddHeaderAction(header, value);

            // Act/Assert
            ExceptionAssert.Throws <ArgumentNullException>(() => action.Execute(context));
        }
示例#2
0
        public void Constructor_SetsHeaderAndValue()
        {
            // Arrange
            string header = "HeaderName";
            string value  = "HeaderValue";

            // Act
            AddHeaderAction action = new AddHeaderAction(header, value);

            // Assert
            Assert.AreEqual(header, action.Header);
            Assert.AreEqual(value, action.Value);
        }
示例#3
0
        public void Execute_SetsResponseHeader_ReturnsContinueProcessing()
        {
            // Arrange
            string          header  = "HeaderName";
            string          value   = "HeaderValue";
            IRewriteContext context = new MockRewriteContext();
            AddHeaderAction action  = new AddHeaderAction(header, value);

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

            // Assert
            CollectionAssert.Contains(context.ResponseHeaders.Keys, header);
            Assert.AreEqual(value, context.ResponseHeaders[header]);
            Assert.AreEqual(RewriteProcessing.ContinueProcessing, result);
        }