public void ShouldExpandVariableWithSizeLimitGreaterThanValue() { UriTemplate template = new UriTemplate("{var:30}"); string result = template.Expand(new { var = "value" }); Assert.AreEqual("value", result); }
public void ShouldExpandVariablesInQueryContinuation() { UriTemplate template = new UriTemplate("?fixed=yes{&x}"); string result = template.Expand(new { x = 1024 }); Assert.AreEqual("?fixed=yes&x=1024", result); }
public void ShouldExpandVariablesWithEmptyInQueryContinuation() { UriTemplate template = new UriTemplate("{&x,y,empty}"); string result = template.Expand(new { x = 1024, y = 768, empty = "" }); Assert.AreEqual("&x=1024&y=768&empty=", result); }
public void ShouldExpandVariablesWithEmptyForPathStyleParameters() { UriTemplate template = new UriTemplate("{;x,y,empty}"); string result = template.Expand(new { x = 1024, y = 768, empty = "" }); Assert.AreEqual(";x=1024;y=768;empty", result); }
public void ShouldExpandVariablesInQuery() { UriTemplate template = new UriTemplate("{?x,y}"); string result = template.Expand(new { x = 1024, y = 768 }); Assert.AreEqual("?x=1024&y=768", result); }
public void ShouldExpandVariablesInPathSegment() { UriTemplate template = new UriTemplate("{/var,x}/here"); string result = template.Expand(new { var = "value", x = 1024 }); Assert.AreEqual("/value/1024/here", result); }
public void ShouldExpandVariableInPathSegment() { UriTemplate template = new UriTemplate("{/var}"); string result = template.Expand(new { var = "value" }); Assert.AreEqual("/value", result); }
public void ShouldExpandVariablesInLabelExpansion() { UriTemplate template = new UriTemplate("X{.x,y}"); string result = template.Expand(new { x = 1024, y = 768 }); Assert.AreEqual("X.1024.768", result); }
public void ShouldExpandVariableWhenReservedAllowed() { UriTemplate template = new UriTemplate("{+var}"); string result = template.Expand(new { var = "value" }); Assert.AreEqual("value", result); }
public void ShouldExpandVariableWithSlashWhenReservedAllowed() { UriTemplate template = new UriTemplate("{+path}/here"); string result = template.Expand(new { path = "/foo/bar" }); Assert.AreEqual("/foo/bar/here", result); }
private Uri applyParameters(string uriTemplate, bool caseSensitive, object uriParameters) { UriTemplate template = new UriTemplate(uriTemplate, caseSensitive); string uri = template.Expand(uriParameters); return(new Uri(uri)); }
public void ShouldExpandVariables() { UriTemplate template = new UriTemplate("map?{x,y}"); string result = template.Expand(new { x = "1024", y = "768" }); Assert.AreEqual("map?1024,768", result); }
public void ShouldExpandListInQuery() { UriTemplate template = new UriTemplate("{?list}"); string result = template.Expand(new { list = new string[] { "red", "green", "blue" } }); Assert.AreEqual("?list=red,green,blue", result); }
public void ShouldExpandVariableWithSizeLimitSmallerThanValueForPathStyleParameters() { UriTemplate template = new UriTemplate("{;hello:5}"); string result = template.Expand(new { hello = "Hello World!" }); Assert.AreEqual(";hello=Hello", result); }
public void ShouldExpandListWhenExplodedForPathStyleParameters() { UriTemplate template = new UriTemplate("{;list*}"); string result = template.Expand(new { list = new string[] { "red", "green", "blue" } }); Assert.AreEqual(";list=red;list=green;list=blue", result); }
public void ShouldExpandVariableWithSpaceWhenReservedAllowed() { UriTemplate template = new UriTemplate("{+hello}"); string result = template.Expand(new { hello = "Hello, World!" }); Assert.AreEqual("Hello,+World!", result); }
public void ShouldExpandVariableWithReservedCharacterInFragmentExpansion() { UriTemplate template = new UriTemplate("X{#hello}"); string result = template.Expand(new { hello = "Hello World!" }); Assert.AreEqual("X#Hello+World!", result); }
public void ShouldExpandVariableInFragmentExpansion() { UriTemplate template = new UriTemplate("X{#var}"); string result = template.Expand(new { var = "value" }); Assert.AreEqual("X#value", result); }
public void ShouldExpandListWhenExplodedInQueryContinuation() { UriTemplate template = new UriTemplate("{&list*}"); string result = template.Expand(new { list = new string[] { "red", "green", "blue" } }); Assert.AreEqual("&list=red&list=green&list=blue", result); }
public void ShouldExpandVariableWithSmallerSizeLimitInLabelExpansion() { UriTemplate template = new UriTemplate("X{.var:3}"); string result = template.Expand(new { var = "value" }); Assert.AreEqual("X.val", result); }
public void ShouldExpandListWhenExplodedInLabelExpansion() { UriTemplate template = new UriTemplate("X{.list*}"); string result = template.Expand(new { list = new string[] { "red", "green", "blue" } }); Assert.AreEqual("X.red.green.blue", result); }
public void ShouldExpandVariablesWithSlashWhenReservedAllowedInFragmentExpansion() { UriTemplate template = new UriTemplate("{#path,x}/here"); string result = template.Expand(new { x = 1024, path = "/foo/bar", y = 768 }); Assert.AreEqual("#/foo/bar,1024/here", result); }
public void ShouldExpandListWhenExplodedInFragmentExpansion() { UriTemplate template = new UriTemplate("{#list*}"); string result = template.Expand(new { list = new string[] { "red", "green", "blue" } }); Assert.AreEqual("#red,green,blue", result); }
public void ShouldExpandVariableWithSmallerSizeLimitInFragmentExpansion() { UriTemplate template = new UriTemplate("{#path:6}/here"); string result = template.Expand(new { path = "/foo/bar" }); Assert.AreEqual("#/foo/b/here", result); }
public void ShouldExpandVariableWithSizeLimitSmallerThanValueInQueryContinuation() { UriTemplate template = new UriTemplate("{&var:3}"); string result = template.Expand(new { var = "value" }); Assert.AreEqual("&var=val", result); }
public void ShouldExpandVariableWithSizeLimitSmallerThanValueInPathSegment() { UriTemplate template = new UriTemplate("{/var:1,var}"); string result = template.Expand(new { var = "value" }); Assert.AreEqual("/v/value", result); }
public void ShouldExpandVariablesWithReservedCharacters() { UriTemplate template = new UriTemplate("{x,hello,y}"); string result = template.Expand(new { x = "1024", hello = "Hello World!", y = 768 }); Assert.AreEqual("1024,Hello+World!,768", result); }
public void ShouldExpandListWhenExplodedInPathSegment() { UriTemplate template = new UriTemplate("{/list}"); string result = template.Expand(new { list = new string[] { "red", "green", "blue" } }); Assert.AreEqual("/red,green,blue", result); }
public void ShouldExpandVariablesWithSpaceWhenReservedAllowedInFragmentExpansion() { UriTemplate template = new UriTemplate("{#x,hello,y}"); string result = template.Expand(new { x = 1024, hello = "Hello World!", y = 768 }); Assert.AreEqual("#1024,Hello+World!,768", result); }
public void ShouldExpandListWhenExplodedWhenReservedAllowed() { UriTemplate template = new UriTemplate("{+list*}"); string result = template.Expand(new { list = new List <string>() { "red", "green", "blue" } }); Assert.AreEqual("red,green,blue", result); }