Throw for trackAllCaptures

This commit is contained in:
Mikael Mengistu 2016-11-04 17:59:04 -07:00 committed by GitHub
parent fa8ec4131f
commit 5d6fcb07da
2 changed files with 25 additions and 0 deletions

View File

@ -110,6 +110,10 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
var grouping = ParseEnum(conditions, RewriteTags.LogicalGrouping, LogicalGrouping.MatchAll);
var trackAllCaptures = ParseBool(conditions, RewriteTags.TrackAllCaptures, defaultValue: false);
if (trackAllCaptures)
{
throw new NotSupportedException("Support for trackAllCaptures has not been implemented yet");
}
builder.AddUrlConditions(grouping, trackAllCaptures);
foreach (var cond in conditions.Elements(RewriteTags.Add))

View File

@ -264,5 +264,26 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
var ex = Assert.Throws<FormatException>(() => new UrlRewriteFileParser().Parse(new StringReader(input)));
Assert.Equal(expected, ex.Message);
}
[Theory]
[InlineData(
@"<rewrite>
<rules>
<rule name=""Remove trailing slash"">
<match url = ""(.*)/$""/>
<conditions trackAllCaptures=""true"">
<add input=""{REQUEST_FILENAME}""/>
</conditions>
<action type=""Redirect"" url =""{R:1}"" />
</rule>
</rules>
</rewrite>",
"Support for trackAllCaptures has not been implemented yet")]
public void ThrowNotSupportedExceptionWithCorrectMessage(string input, string expected)
{
// Arrange, Act, Assert
var ex = Assert.Throws<NotSupportedException>(() => new UrlRewriteFileParser().Parse(new StringReader(input)));
Assert.Equal(expected, ex.Message);
}
}
}