public void ShouldKeepStartingBackslashOnUriTemplateValue()
 {
     var uriFactory = new UriFactoryWorker("orders", "/?a=b");
     Assert.AreEqual("http://restbucks.com/orders/?a=b", uriFactory.CreateAbsoluteUri(new Uri("http://restbucks.com")).ToString());
 }
 public void ShouldUseTheSuppliedBaseAddressUpToLastBackslash()
 {
     var uriFactory = new UriFactoryWorker("quotes", "{userId}/{id}");
     Assert.AreEqual("http://restbucks.com:8080/virtual-directory/quotes/ian/1", uriFactory.CreateAbsoluteUri(new Uri("http://restbucks.com:8080/virtual-directory/suffix"), "ian", "1").ToString());
 }
 public void ShouldGenerateRelativeUriFromRoutePrefixAndTemplateAndTemplateParameters()
 {
     var uriFactory = new UriFactoryWorker("quotes", "{userId}/{id}");
     Assert.AreEqual("quotes/ian/1", uriFactory.CreateRelativeUri("ian", "1").ToString());
 }
 public void ShouldGenerateRelativeUriWithTerminatingBackslashWhenTemplateIsBackslash()
 {
     var uriFactory = new UriFactoryWorker("quotes", "/");
     Assert.AreEqual("quotes/", uriFactory.CreateRelativeUri().ToString());
 }
 public void ShouldGenerateBaseUriWithTerminatingBackslashFromSuppliedAbsoluteUri()
 {
     var uriFactory = new UriFactoryWorker("quotes", "{quoteId}");
     Assert.AreEqual(new Uri("http://restbucks.com:8080/uk/"), uriFactory.CreateBaseUri(new Uri("http://restbucks.com:8080/uk/quotes/1234")));
 }
 public void ShouldGenerateAbsoluteUriWithTerminatingBackslashWhenTemplateIsBackslash()
 {
     var uriFactory = new UriFactoryWorker("quotes", "/");
     Assert.AreEqual("http://restbucks.com/quotes/", uriFactory.CreateAbsoluteUri(new Uri("http://restbucks.com")).ToString());
 }
 public void ShouldGenerateAbsoluteUriFromBaseAddressAndRoutePrefixAndTempleAndTemplateParameters()
 {
     var uriFactory = new UriFactoryWorker("quotes", "{userId}/{id}");
     Assert.AreEqual("http://restbucks.com/quotes/ian/1", uriFactory.CreateAbsoluteUri(new Uri("http://restbucks.com"), "ian", "1").ToString());
 }
 public void ThrowsExceptionWhenSuppliedUriDoesNotContainRoutePrefix()
 {
     var uriFactory = new UriFactoryWorker("quotes", "{quoteId}");
     uriFactory.CreateBaseUri(new Uri("http://restbucks.com:8080/uk/customers/1234"));
 }
 public UriTemplateAttribute(string routePrefix, string uriTemplate)
 {
     uriFactoryWorker = new UriFactoryWorker(routePrefix, uriTemplate);
 }