Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<!--
Restore sources should be defined in eng/Versions.props.
The only allowed feeds here are dotnet-core and nuget.org, which is required to work around
https://github.com/Microsoft/msbuild/issues/2914
-->
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
Expand Down
388 changes: 194 additions & 194 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

194 changes: 97 additions & 97 deletions eng/Versions.props

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions src/Antiforgery/test/DefaultAntiforgeryTokenGeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ public void TryValidateTokenSet_CookieTokenMissing()
var ex = Assert.Throws<ArgumentNullException>(
() => tokenProvider.TryValidateTokenSet(httpContext, null, fieldtoken, out message));

var trimmed = ex.Message.Substring(0, ex.Message.IndexOf(Environment.NewLine));
Assert.Equal(@"The required antiforgery cookie token must be provided.", trimmed);
Assert.StartsWith(@"The required antiforgery cookie token must be provided.", ex.Message);
}

[Fact]
Expand All @@ -307,8 +306,7 @@ public void TryValidateTokenSet_FieldTokenMissing()
var ex = Assert.Throws<ArgumentNullException>(
() => tokenProvider.TryValidateTokenSet(httpContext, cookieToken, null, out message));

var trimmed = ex.Message.Substring(0, ex.Message.IndexOf(Environment.NewLine));
Assert.Equal("The required antiforgery request token must be provided.", trimmed);
Assert.StartsWith("The required antiforgery request token must be provided.", ex.Message);
}

[Fact]
Expand Down Expand Up @@ -625,4 +623,4 @@ public override string Name
}
}
}
}
}
84 changes: 27 additions & 57 deletions src/Http/Routing/test/UnitTests/Template/TemplateParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public void Parse_RegularExpressions_Invalid(string template)
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse(template),
"There is an incomplete parameter in the route template. Check that each '{' character has a matching " +
"'}' character." + Environment.NewLine + "Parameter name: routeTemplate");
"'}' character. (Parameter 'routeTemplate')");
}

[Theory]
Expand All @@ -521,8 +521,7 @@ public void Parse_RegularExpressions_Unescaped(string template)
// Act and Assert
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse(template),
"In a route parameter, '{' and '}' must be escaped with '{{' and '}}'." + Environment.NewLine +
"Parameter name: routeTemplate");
"In a route parameter, '{' and '}' must be escaped with '{{' and '}}'. (Parameter 'routeTemplate')");
}

[Theory]
Expand All @@ -541,8 +540,7 @@ public void Parse_ComplexSegment_OptionalParameter_NotTheLastPart(
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse(template),
"An optional parameter must be at the end of the segment. In the segment '" + template +
"', optional parameter '" + parameter + "' is followed by '" + invalid + "'."
+ Environment.NewLine + "Parameter name: routeTemplate");
"', optional parameter '" + parameter + "' is followed by '" + invalid + "'. (Parameter 'routeTemplate')");
}

[Theory]
Expand All @@ -557,9 +555,8 @@ public void Parse_ComplexSegment_OptionalParametersSeperatedByPeriod_Invalid(str
// Act and Assert
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse(template),
"In the segment '"+ template +"', the optional parameter 'p2' is preceded by an invalid " +
"segment '" + parameter +"'. Only a period (.) can precede an optional parameter." +
Environment.NewLine + "Parameter name: routeTemplate");
"In the segment '" + template + "', the optional parameter 'p2' is preceded by an invalid " +
"segment '" + parameter + "'. Only a period (.) can precede an optional parameter. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -568,8 +565,7 @@ public void InvalidTemplate_WithRepeatedParameter()
{
var ex = ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{Controller}.mvc/{id}/{controller}"),
"The route parameter name 'controller' appears more than one time in the route template." +
Environment.NewLine + "Parameter name: routeTemplate");
"The route parameter name 'controller' appears more than one time in the route template. (Parameter 'routeTemplate')");
}

[Theory]
Expand All @@ -585,8 +581,7 @@ public void InvalidTemplate_WithMismatchedBraces(string template)
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse(template),
@"There is an incomplete parameter in the route template. Check that each '{' character has a " +
"matching '}' character." + Environment.NewLine +
"Parameter name: routeTemplate");
"matching '}' character. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -596,8 +591,7 @@ public void InvalidTemplate_CannotHaveCatchAllInMultiSegment()
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("123{a}abc{*moo}"),
"A path segment that contains more than one section, such as a literal section or a parameter, " +
"cannot contain a catch-all parameter." + Environment.NewLine +
"Parameter name: routeTemplate");
"cannot contain a catch-all parameter. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -606,9 +600,7 @@ public void InvalidTemplate_CannotHaveMoreThanOneCatchAll()
{
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{*p1}/{*p2}"),
"A catch-all parameter can only appear as the last segment of the route template." +
Environment.NewLine +
"Parameter name: routeTemplate");
"A catch-all parameter can only appear as the last segment of the route template. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -618,8 +610,7 @@ public void InvalidTemplate_CannotHaveMoreThanOneCatchAllInMultiSegment()
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{*p1}abc{*p2}"),
"A path segment that contains more than one section, such as a literal section or a parameter, " +
"cannot contain a catch-all parameter." + Environment.NewLine +
"Parameter name: routeTemplate");
"cannot contain a catch-all parameter. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -631,8 +622,7 @@ public void InvalidTemplate_CannotHaveCatchAllWithNoName()
"The route parameter name '' is invalid. Route parameter names must be non-empty and cannot" +
" contain these characters: '{', '}', '/'. The '?' character marks a parameter as optional," +
" and can occur only at the end of the parameter. The '*' character marks a parameter as catch-all," +
" and can occur only at the start of the parameter." + Environment.NewLine +
"Parameter name: routeTemplate");
" and can occur only at the start of the parameter. (Parameter 'routeTemplate')");
}

[Theory]
Expand All @@ -658,8 +648,7 @@ public void ParseRouteParameter_ThrowsIf_ParameterContainsSpecialCharacters(

// Act & Assert
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse(template), expectedMessage + Environment.NewLine +
"Parameter name: routeTemplate");
() => TemplateParser.Parse(template), expectedMessage + " (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -669,8 +658,7 @@ public void InvalidTemplate_CannotHaveConsecutiveOpenBrace()
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/{{p1}"),
"There is an incomplete parameter in the route template. Check that each '{' character has a " +
"matching '}' character." + Environment.NewLine +
"Parameter name: routeTemplate");
"matching '}' character. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -680,8 +668,7 @@ public void InvalidTemplate_CannotHaveConsecutiveCloseBrace()
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/{p1}}"),
"There is an incomplete parameter in the route template. Check that each '{' character has a " +
"matching '}' character." + Environment.NewLine +
"Parameter name: routeTemplate");
"matching '}' character. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -690,9 +677,7 @@ public void InvalidTemplate_SameParameterTwiceThrows()
{
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{aaa}/{AAA}"),
"The route parameter name 'AAA' appears more than one time in the route template." +
Environment.NewLine +
"Parameter name: routeTemplate");
"The route parameter name 'AAA' appears more than one time in the route template. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -701,9 +686,7 @@ public void InvalidTemplate_SameParameterTwiceAndOneCatchAllThrows()
{
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{aaa}/{*AAA}"),
"The route parameter name 'AAA' appears more than one time in the route template." +
Environment.NewLine +
"Parameter name: routeTemplate");
"The route parameter name 'AAA' appears more than one time in the route template. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -713,8 +696,7 @@ public void InvalidTemplate_InvalidParameterNameWithCloseBracketThrows()
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}/{aa}a}/{z}"),
"There is an incomplete parameter in the route template. Check that each '{' character has a " +
"matching '}' character." + Environment.NewLine +
"Parameter name: routeTemplate");
"matching '}' character. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -723,8 +705,7 @@ public void InvalidTemplate_InvalidParameterNameWithOpenBracketThrows()
{
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}/{a{aa}/{z}"),
"In a route parameter, '{' and '}' must be escaped with '{{' and '}}'." + Environment.NewLine +
"Parameter name: routeTemplate");
"In a route parameter, '{' and '}' must be escaped with '{{' and '}}'. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -736,8 +717,7 @@ public void InvalidTemplate_InvalidParameterNameWithEmptyNameThrows()
"The route parameter name '' is invalid. Route parameter names must be non-empty and cannot" +
" contain these characters: '{', '}', '/'. The '?' character marks a parameter as optional, and" +
" can occur only at the end of the parameter. The '*' character marks a parameter as catch-all," +
" and can occur only at the start of the parameter." + Environment.NewLine +
"Parameter name: routeTemplate");
" and can occur only at the start of the parameter. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -749,8 +729,7 @@ public void InvalidTemplate_InvalidParameterNameWithQuestionThrows()
"The route parameter name '' is invalid. Route parameter names must be non-empty and cannot" +
" contain these characters: '{', '}', '/'. The '?' character marks a parameter as optional, and" +
" can occur only at the end of the parameter. The '*' character marks a parameter as catch-all," +
" and can occur only at the start of the parameter." + Environment.NewLine +
"Parameter name: routeTemplate");
" and can occur only at the start of the parameter. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -760,8 +739,7 @@ public void InvalidTemplate_ConsecutiveSeparatorsSlashSlashThrows()
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}//{z}"),
"The route template separator character '/' cannot appear consecutively. It must be separated by " +
"either a parameter or a literal value." + Environment.NewLine +
"Parameter name: routeTemplate");
"either a parameter or a literal value. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -770,9 +748,7 @@ public void InvalidTemplate_WithCatchAllNotAtTheEndThrows()
{
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/{p1}/{*p2}/{p3}"),
"A catch-all parameter can only appear as the last segment of the route template." +
Environment.NewLine +
"Parameter name: routeTemplate");
"A catch-all parameter can only appear as the last segment of the route template. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -782,8 +758,7 @@ public void InvalidTemplate_RepeatedParametersThrows()
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/aa{p1}{p2}"),
"A path segment cannot contain two consecutive parameters. They must be separated by a '/' or by " +
"a literal string." + Environment.NewLine +
"Parameter name: routeTemplate");
"a literal string. (Parameter 'routeTemplate')");
}

[Theory]
Expand All @@ -804,8 +779,7 @@ public void InvalidTemplate_CannotStartWithTilde()
{
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("~foo"),
"The route template cannot start with a '~' character unless followed by a '/'." + Environment.NewLine +
"Parameter name: routeTemplate");
"The route template cannot start with a '~' character unless followed by a '/'. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -814,9 +788,7 @@ public void InvalidTemplate_CannotContainQuestionMark()
{
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foor?bar"),
"The literal section 'foor?bar' is invalid. Literal sections cannot contain the '?' character." +
Environment.NewLine +
"Parameter name: routeTemplate");
"The literal section 'foor?bar' is invalid. Literal sections cannot contain the '?' character. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -828,8 +800,7 @@ public void InvalidTemplate_ParameterCannotContainQuestionMark_UnlessAtEnd()
"The route parameter name 'foor?b' is invalid. Route parameter names must be non-empty and cannot" +
" contain these characters: '{', '}', '/'. The '?' character marks a parameter as optional, and" +
" can occur only at the end of the parameter. The '*' character marks a parameter as catch-all," +
" and can occur only at the start of the parameter." + Environment.NewLine +
"Parameter name: routeTemplate");
" and can occur only at the start of the parameter. (Parameter 'routeTemplate')");
}

[Fact]
Expand All @@ -838,8 +809,7 @@ public void InvalidTemplate_CatchAllMarkedOptional()
{
ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}/{*b?}"),
"A catch-all parameter cannot be marked optional." + Environment.NewLine +
"Parameter name: routeTemplate");
"A catch-all parameter cannot be marked optional. (Parameter 'routeTemplate')");
}

private class TemplateEqualityComparer : IEqualityComparer<RouteTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ public void EmptyDefaultValue_WithOptionalParameter_Throws()
Assert.Equal(message, ex.Message);

Assert.NotNull(ex.InnerException);
message = "An optional parameter cannot have default value." + Environment.NewLine +
"Parameter name: routeTemplate";
message = "An optional parameter cannot have default value. (Parameter 'routeTemplate')";
Assert.Equal(message, ex.InnerException.Message);
}

Expand All @@ -122,8 +121,7 @@ public void NonEmptyDefaultValue_WithOptionalParameter_Throws()
Assert.Equal(message, ex.Message);

Assert.NotNull(ex.InnerException);
message = "An optional parameter cannot have default value." + Environment.NewLine +
"Parameter name: routeTemplate";
message = "An optional parameter cannot have default value. (Parameter 'routeTemplate')";
Assert.Equal(message, ex.InnerException.Message);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/CORS/test/UnitTests/CorsPolicyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void SettingNegativePreflightMaxAge_Throws()

// Assert
Assert.Equal(
$"PreflightMaxAge must be greater than or equal to 0.{Environment.NewLine}Parameter name: value",
$"PreflightMaxAge must be greater than or equal to 0. (Parameter 'value')",
exception.Message);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/CORS/test/UnitTests/CorsResultTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void SettingNegativePreflightMaxAge_Throws()

// Assert
Assert.Equal(
$"PreflightMaxAge must be greater than or equal to 0.{Environment.NewLine}Parameter name: value",
$"PreflightMaxAge must be greater than or equal to 0. (Parameter 'value')",
exception.Message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,7 @@ public void SetProperty_PropertyIsSettable_SetterThrows_RecordsError()
binder.SetPropertyPublic(bindingContext, "foo", propertyMetadata, result);

// Assert
Assert.Equal("Date of death can't be before date of birth." + Environment.NewLine
+ "Parameter name: value",
Assert.Equal("Date of death can't be before date of birth. (Parameter 'value')",
bindingContext.ModelState["foo"].Errors[0].Exception.Message);
}

Expand All @@ -1219,8 +1218,7 @@ public void SetProperty_PropertySetterThrows_CapturesException()
// Assert
Assert.False(bindingContext.ModelState.IsValid);
Assert.Single(bindingContext.ModelState["foo.NameNoAttribute"].Errors);
Assert.Equal("This is a different exception." + Environment.NewLine
+ "Parameter name: value",
Assert.Equal("This is a different exception. (Parameter 'value')",
bindingContext.ModelState["foo.NameNoAttribute"].Errors[0].Exception.Message);
}

Expand Down
Loading