// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.IO; using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite { // TODO add more of these public class UrlRewriteApplicationTests { [Fact] public void ApplyRule_AssertStopProcessingFlagWillTerminateOnNoAction() { var xml = new StringReader(@" "); var rules = new UrlRewriteFileParser().Parse(xml); Assert.Equal(rules.Count, 1); var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; rules.FirstOrDefault().ApplyRule(context); Assert.Equal(context.Result, RuleTermination.StopRules); } [Fact] public void ApplyRule_AssertNoTerminateFlagWillNotTerminateOnNoAction() { var xml = new StringReader(@" "); var rules = new UrlRewriteFileParser().Parse(xml); Assert.Equal(rules.Count, 1); var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; rules.FirstOrDefault().ApplyRule(context); Assert.Equal(context.Result, RuleTermination.Continue); } } }