Created
August 27, 2012 13:20
-
-
Save ysw/3488351 to your computer and use it in GitHub Desktop.
UriTemplate mono bahvior tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using NUnit.Framework; | |
namespace Core.Tests.Other | |
{ | |
[TestFixture] | |
class when_matching_remaining_path | |
{ | |
private UriTemplate _urlTemplate; | |
private UriTemplateMatch _match; | |
[SetUp] | |
public void setup() | |
{ | |
_urlTemplate = new UriTemplate("/a/b/{*C}"); | |
_match = _urlTemplate.Match(new Uri("http://localhost"), new Uri("http://localhost/a/b/123")); | |
} | |
[Test] | |
public void bound_variable_c_is_available() | |
{ | |
Assert.IsTrue(_match.BoundVariables.AllKeys.Contains("C")); | |
} | |
[Test] | |
public void bound_variable_c_contains_remaining_path() | |
{ | |
Assert.AreEqual("123", _match.BoundVariables["C"]); | |
} | |
} | |
[TestFixture] | |
class when_matching_remaining_multi_segment_path | |
{ | |
private UriTemplate _urlTemplate; | |
private UriTemplateMatch _match; | |
[SetUp] | |
public void setup() | |
{ | |
_urlTemplate = new UriTemplate("/a/b/{*C}"); | |
_match = _urlTemplate.Match(new Uri("http://localhost"), new Uri("http://localhost/a/b/123/456")); | |
} | |
[Test] | |
public void bound_variable_c_is_available() | |
{ | |
Assert.IsTrue(_match.BoundVariables.AllKeys.Contains("C")); | |
} | |
[Test] | |
public void bound_variable_c_contains_remaining_path() | |
{ | |
Assert.AreEqual("123/456", _match.BoundVariables["C"]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment