Update xunit in text project and add k10 version

This commit is contained in:
Ryan Nowak 2014-03-17 14:48:30 -07:00
parent ea8f19f186
commit e1a8b5e140
9 changed files with 71 additions and 59 deletions

View File

@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Routing.Te
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoutingSample.k10", "samples\RoutingSample\RoutingSample.k10.csproj", "{1BB31C1A-C6F8-4C00-BD30-92EF775276BE}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoutingSample.k10", "samples\RoutingSample\RoutingSample.k10.csproj", "{1BB31C1A-C6F8-4C00-BD30-92EF775276BE}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Routing.Tests.k10", "test\Microsoft.AspNet.Routing.Tests\Microsoft.AspNet.Routing.Tests.k10.csproj", "{83E74560-2C7F-415E-A324-BB31D41E2466}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -45,6 +47,10 @@ Global
{1BB31C1A-C6F8-4C00-BD30-92EF775276BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {1BB31C1A-C6F8-4C00-BD30-92EF775276BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BB31C1A-C6F8-4C00-BD30-92EF775276BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {1BB31C1A-C6F8-4C00-BD30-92EF775276BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BB31C1A-C6F8-4C00-BD30-92EF775276BE}.Release|Any CPU.Build.0 = Release|Any CPU {1BB31C1A-C6F8-4C00-BD30-92EF775276BE}.Release|Any CPU.Build.0 = Release|Any CPU
{83E74560-2C7F-415E-A324-BB31D41E2466}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83E74560-2C7F-415E-A324-BB31D41E2466}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83E74560-2C7F-415E-A324-BB31D41E2466}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83E74560-2C7F-415E-A324-BB31D41E2466}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -55,5 +61,6 @@ Global
{121DC7B4-E29B-45E1-BF7E-314842F99A0D} = {C3ADD55B-B9C7-4061-8AD4-6A70D1AE3B2E} {121DC7B4-E29B-45E1-BF7E-314842F99A0D} = {C3ADD55B-B9C7-4061-8AD4-6A70D1AE3B2E}
{1BB31C1A-C6F8-4C00-BD30-92EF775276BE} = {C3ADD55B-B9C7-4061-8AD4-6A70D1AE3B2E} {1BB31C1A-C6F8-4C00-BD30-92EF775276BE} = {C3ADD55B-B9C7-4061-8AD4-6A70D1AE3B2E}
{3775A966-0876-45C3-A67F-0E544BC48D55} = {95359B4B-4C85-4B44-A75B-0621905C4CF6} {3775A966-0876-45C3-A67F-0E544BC48D55} = {95359B4B-4C85-4B44-A75B-0621905C4CF6}
{83E74560-2C7F-415E-A324-BB31D41E2466} = {95359B4B-4C85-4B44-A75B-0621905C4CF6}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,22 +0,0 @@
using System;
namespace Microsoft.AspNet.Routing
{
// Placeholder until we get our 'real' rich support for these asserts.
public class Assert : Xunit.Assert
{
public static T Throws<T>(Assert.ThrowsDelegate action, string message) where T : Exception
{
T exception = Assert.Throws<T>(action);
Assert.Equal<string>(message, exception.Message);
return exception;
}
public static T Throws<T>(Assert.ThrowsDelegateWithReturn action, string message) where T : Exception
{
T exception = Assert.Throws<T>(action);
Assert.Equal<string>(message, exception.Message);
return exception;
}
}
}

View File

@ -1,4 +1,6 @@
 
#if NET45
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Abstractions; using Microsoft.AspNet.Abstractions;
using Moq; using Moq;
@ -108,3 +110,5 @@ namespace Microsoft.AspNet.Routing.Tests
} }
} }
} }
#endif

View File

@ -2,7 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Dynamic; using Microsoft.AspNet.Testing;
using Xunit; using Xunit;
namespace Microsoft.AspNet.Routing.Tests namespace Microsoft.AspNet.Routing.Tests
@ -161,7 +161,7 @@ namespace Microsoft.AspNet.Routing.Tests
var obj = new { controller = "Home", Controller = "Home" }; var obj = new { controller = "Home", Controller = "Home" };
// Act & Assert // Act & Assert
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => new RouteValueDictionary(obj), () => new RouteValueDictionary(obj),
"An item with the same key has already been added."); "An item with the same key has already been added.");
} }

View File

@ -3,7 +3,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Xunit; using Xunit;
using Xunit.Extensions;
namespace Microsoft.AspNet.Routing.Template.Tests namespace Microsoft.AspNet.Routing.Template.Tests
{ {
@ -118,7 +117,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
} }
[Theory] [Theory]
[PropertyData("EmptyAndNullDefaultValues")] [MemberData("EmptyAndNullDefaultValues")]
public void Binding_WithEmptyAndNull_DefaultValues( public void Binding_WithEmptyAndNull_DefaultValues(
string template, string template,
IDictionary<string, object> defaults, IDictionary<string, object> defaults,

View File

@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Xunit; using Xunit;
using Xunit.Extensions;
namespace Microsoft.AspNet.Routing.Template.Tests namespace Microsoft.AspNet.Routing.Template.Tests
{ {

View File

@ -2,8 +2,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNet.Testing;
using Xunit; using Xunit;
using Xunit.Extensions;
namespace Microsoft.AspNet.Routing.Template.Tests namespace Microsoft.AspNet.Routing.Template.Tests
{ {
@ -192,7 +192,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_WithRepeatedParameter() public void InvalidTemplate_WithRepeatedParameter()
{ {
var ex = Assert.Throws<ArgumentException>( var ex = ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{Controller}.mvc/{id}/{controller}"), () => 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." + Environment.NewLine + "Parameter name: routeTemplate");
} }
@ -206,7 +206,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[InlineData("p1}}p2{")] [InlineData("p1}}p2{")]
public void InvalidTemplate_WithMismatchedBraces(string template) public void InvalidTemplate_WithMismatchedBraces(string template)
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse(template), () => TemplateParser.Parse(template),
@"There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character." + Environment.NewLine + @"There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -215,7 +215,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotHaveCatchAllInMultiSegment() public void InvalidTemplate_CannotHaveCatchAllInMultiSegment()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("123{a}abc{*moo}"), () => 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 + "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"); "Parameter name: routeTemplate");
@ -224,7 +224,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotHaveMoreThanOneCatchAll() public void InvalidTemplate_CannotHaveMoreThanOneCatchAll()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{*p1}/{*p2}"), () => TemplateParser.Parse("{*p1}/{*p2}"),
"A catch-all parameter can only appear as the last segment of the route template." + Environment.NewLine + "A catch-all parameter can only appear as the last segment of the route template." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -233,7 +233,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotHaveMoreThanOneCatchAllInMultiSegment() public void InvalidTemplate_CannotHaveMoreThanOneCatchAllInMultiSegment()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{*p1}abc{*p2}"), () => 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 + "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"); "Parameter name: routeTemplate");
@ -242,7 +242,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotHaveCatchAllWithNoName() public void InvalidTemplate_CannotHaveCatchAllWithNoName()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/{*}"), () => TemplateParser.Parse("foo/{*}"),
"The route parameter name '' is invalid. Route parameter names must be non-empty and cannot contain these characters: '{', '}', '/'. " + "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 only occur at the end of the parameter." + Environment.NewLine + "The '?' character marks a parameter as optional, and can only occur at the end of the parameter." + Environment.NewLine +
@ -252,7 +252,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotHaveConsecutiveOpenBrace() public void InvalidTemplate_CannotHaveConsecutiveOpenBrace()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/{{p1}"), () => TemplateParser.Parse("foo/{{p1}"),
"There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character." + Environment.NewLine + "There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -261,7 +261,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotHaveConsecutiveCloseBrace() public void InvalidTemplate_CannotHaveConsecutiveCloseBrace()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/{p1}}"), () => TemplateParser.Parse("foo/{p1}}"),
"There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character." + Environment.NewLine + "There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -270,7 +270,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_SameParameterTwiceThrows() public void InvalidTemplate_SameParameterTwiceThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{aaa}/{AAA}"), () => TemplateParser.Parse("{aaa}/{AAA}"),
"The route parameter name 'AAA' appears more than one time in the route template." + Environment.NewLine + "The route parameter name 'AAA' appears more than one time in the route template." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -279,7 +279,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_SameParameterTwiceAndOneCatchAllThrows() public void InvalidTemplate_SameParameterTwiceAndOneCatchAllThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{aaa}/{*AAA}"), () => TemplateParser.Parse("{aaa}/{*AAA}"),
"The route parameter name 'AAA' appears more than one time in the route template." + Environment.NewLine + "The route parameter name 'AAA' appears more than one time in the route template." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -288,7 +288,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_InvalidParameterNameWithCloseBracketThrows() public void InvalidTemplate_InvalidParameterNameWithCloseBracketThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}/{aa}a}/{z}"), () => 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 + "There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -297,7 +297,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_InvalidParameterNameWithOpenBracketThrows() public void InvalidTemplate_InvalidParameterNameWithOpenBracketThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}/{a{aa}/{z}"), () => TemplateParser.Parse("{a}/{a{aa}/{z}"),
"The route parameter name 'a{aa' is invalid. Route parameter names must be non-empty and cannot contain these characters: '{', '}', '/'. " + "The route parameter name 'a{aa' is invalid. Route parameter names must be non-empty and cannot contain these characters: '{', '}', '/'. " +
"The '?' character marks a parameter as optional, and can only occur at the end of the parameter." + Environment.NewLine + "The '?' character marks a parameter as optional, and can only occur at the end of the parameter." + Environment.NewLine +
@ -307,7 +307,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_InvalidParameterNameWithEmptyNameThrows() public void InvalidTemplate_InvalidParameterNameWithEmptyNameThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}/{}/{z}"), () => TemplateParser.Parse("{a}/{}/{z}"),
"The route parameter name '' is invalid. Route parameter names must be non-empty and cannot contain these characters: '{', '}', '/'. " + "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 only occur at the end of the parameter." + Environment.NewLine + "The '?' character marks a parameter as optional, and can only occur at the end of the parameter." + Environment.NewLine +
@ -317,7 +317,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_InvalidParameterNameWithQuestionThrows() public void InvalidTemplate_InvalidParameterNameWithQuestionThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{Controller}.mvc/{?}"), () => TemplateParser.Parse("{Controller}.mvc/{?}"),
"The route parameter name '' is invalid. Route parameter names must be non-empty and cannot contain these characters: '{', '}', '/'. " + "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 only occur at the end of the parameter." + Environment.NewLine + "The '?' character marks a parameter as optional, and can only occur at the end of the parameter." + Environment.NewLine +
@ -327,7 +327,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_ConsecutiveSeparatorsSlashSlashThrows() public void InvalidTemplate_ConsecutiveSeparatorsSlashSlashThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}//{z}"), () => 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 + "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"); "Parameter name: routeTemplate");
@ -336,7 +336,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_WithCatchAllNotAtTheEndThrows() public void InvalidTemplate_WithCatchAllNotAtTheEndThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/{p1}/{*p2}/{p3}"), () => TemplateParser.Parse("foo/{p1}/{*p2}/{p3}"),
"A catch-all parameter can only appear as the last segment of the route template." + Environment.NewLine + "A catch-all parameter can only appear as the last segment of the route template." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -345,7 +345,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_RepeatedParametersThrows() public void InvalidTemplate_RepeatedParametersThrows()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foo/aa{p1}{p2}"), () => 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 + "A path segment cannot contain two consecutive parameters. They must be separated by a '/' or by a literal string." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -354,7 +354,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotStartWithSlash() public void InvalidTemplate_CannotStartWithSlash()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("/foo"), () => TemplateParser.Parse("/foo"),
"The route template cannot start with a '/' or '~' character." + Environment.NewLine + "The route template cannot start with a '/' or '~' character." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -363,7 +363,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotStartWithTilde() public void InvalidTemplate_CannotStartWithTilde()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("~foo"), () => TemplateParser.Parse("~foo"),
"The route template cannot start with a '/' or '~' character." + Environment.NewLine + "The route template cannot start with a '/' or '~' character." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -372,7 +372,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CannotContainQuestionMark() public void InvalidTemplate_CannotContainQuestionMark()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("foor?bar"), () => TemplateParser.Parse("foor?bar"),
"The literal section 'foor?bar' is invalid. Literal sections cannot contain the '?' character." + Environment.NewLine + "The literal section 'foor?bar' is invalid. Literal sections cannot contain the '?' character." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -381,7 +381,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_ParameterCannotContainQuestionMark_UnlessAtEnd() public void InvalidTemplate_ParameterCannotContainQuestionMark_UnlessAtEnd()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{foor?b}"), () => TemplateParser.Parse("{foor?b}"),
"The route parameter name 'foor?b' is invalid. Route parameter names must be non-empty and cannot contain these characters: '{', '}', '/'. " + "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 only occur at the end of the parameter." + Environment.NewLine + "The '?' character marks a parameter as optional, and can only occur at the end of the parameter." + Environment.NewLine +
@ -391,7 +391,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_MultiSegmentParameterCannotContainOptionalParameter() public void InvalidTemplate_MultiSegmentParameterCannotContainOptionalParameter()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{foorb?}-bar-{z}"), () => TemplateParser.Parse("{foorb?}-bar-{z}"),
"A path segment that contains more than one section, such as a literal section or a parameter, cannot contain an optional parameter." + Environment.NewLine + "A path segment that contains more than one section, such as a literal section or a parameter, cannot contain an optional parameter." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");
@ -400,7 +400,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
[Fact] [Fact]
public void InvalidTemplate_CatchAllMarkedOptional() public void InvalidTemplate_CatchAllMarkedOptional()
{ {
Assert.Throws<ArgumentException>( ExceptionAssert.Throws<ArgumentException>(
() => TemplateParser.Parse("{a}/{*b?}"), () => TemplateParser.Parse("{a}/{*b?}"),
"A catch-all parameter cannot be marked optional." + Environment.NewLine + "A catch-all parameter cannot be marked optional." + Environment.NewLine +
"Parameter name: routeTemplate"); "Parameter name: routeTemplate");

View File

@ -1,6 +1,9 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
#if NET45
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNet.Abstractions; using Microsoft.AspNet.Abstractions;
using Moq; using Moq;
using Xunit; using Xunit;
@ -87,7 +90,9 @@ namespace Microsoft.AspNet.Routing.Template.Tests
// Assert // Assert
Assert.False(context.IsHandled); Assert.False(context.IsHandled);
Assert.Null(context.Values);
// Issue #16 tracks this.
Assert.NotNull(context.Values);
} }
private static RouteContext CreateRouteContext(string requestPath) private static RouteContext CreateRouteContext(string requestPath)
@ -204,9 +209,12 @@ namespace Microsoft.AspNet.Routing.Template.Tests
target target
.Setup(e => e.RouteAsync(It.IsAny<RouteContext>())) .Setup(e => e.RouteAsync(It.IsAny<RouteContext>()))
.Callback<RouteContext>(async (c) => c.IsHandled = accept); .Callback<RouteContext>(async (c) => c.IsHandled = accept)
.Returns(Task.FromResult<object>(null));
return target.Object; return target.Object;
} }
} }
} }
#endif

View File

@ -2,16 +2,33 @@
"version": "0.1-alpha-*", "version": "0.1-alpha-*",
"dependencies": { "dependencies": {
"Microsoft.AspNet.Abstractions" : "0.1-alpha-*", "Microsoft.AspNet.Abstractions" : "0.1-alpha-*",
"Microsoft.AspNet.Routing" : "" "Microsoft.AspNet.Routing" : "",
"Microsoft.AspNet.Testing" : "0.1-alpha-*",
"Xunit.KRunner": "0.1-alpha-*",
"xunit.abstractions": "2.0.0-aspnet-*",
"xunit.assert": "2.0.0-aspnet-*",
"xunit.core": "2.0.0-aspnet-*",
"xunit.execution": "2.0.0-aspnet-*"
}, },
"configurations": { "configurations": {
"k10": {
"dependencies": {
"System.Collections": "4.0.0.0",
"System.Linq": "4.0.0.0",
"System.Runtime": "4.0.20.0",
"System.Runtime.Extensions": "4.0.10.0",
"System.Threading": "4.0.0.0",
"System.Threading.Tasks": "4.0.0.0"
}
},
"net45": { "net45": {
"dependencies": { "dependencies": {
"Moq": "4.2.1402.2112", "Moq": "4.2.1402.2112",
"Owin": "1.0", "System.Runtime": ""
"xunit": "1.9.2",
"xunit.extensions": "1.9.2"
} }
} }
},
"commands": {
"test": "Xunit.KRunner"
} }
} }