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)); }
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); }