public void ShouldUseTheSuppliedBaseAddressUpToLastBackslash()
 {
     var uriFactory = new UriFactoryWorker("encounters", "{encounterId}/rounds/{roundId}");
     Assert.AreEqual("http://restinpractice.com:8080/virtual-directory/encounters/1/rounds/2", uriFactory.CreateAbsoluteUri(new Uri("http://restinpractice.com:8080/virtual-directory/suffix"), "1", "2").ToString());
 }
 public UriTemplateAttribute(string routePrefix, string uriTemplate)
 {
     uriFactoryWorker = new UriFactoryWorker(routePrefix, uriTemplate);
 }
 public void ShouldGenerateRelativeUriWithTerminatingBackslashWhenTemplateIsBackslash()
 {
     var uriFactory = new UriFactoryWorker("encounters", "/");
     Assert.AreEqual("encounters/", uriFactory.CreateRelativeUri().ToString());
 }
 public void ShouldKeepStartingBackslashOnUriTemplateValue()
 {
     var uriFactory = new UriFactoryWorker("rooms", "/?a=b");
     Assert.AreEqual("http://restinpractice.com/rooms/?a=b", uriFactory.CreateAbsoluteUri(new Uri("http://restinpractice.com")).ToString());
 }
 public void ShouldGenerateRelativeUriFromRoutePrefixAndTemplateAndTemplateParameters()
 {
     var uriFactory = new UriFactoryWorker("encounters", "{encounterId}/rounds/{roundId}");
     Assert.AreEqual("encounters/1/rounds/2", uriFactory.CreateRelativeUri("1", "2").ToString());
 }
 public void ShouldGenerateBaseUriWithTerminatingBackslashFromSuppliedAbsoluteUri()
 {
     var uriFactory = new UriFactoryWorker("rooms", "{roomId}");
     Assert.AreEqual(new Uri("http://restinpractice.com:8080/uk/"), uriFactory.CreateBaseUri(new Uri("http://restinpractice.com:8080/uk/rooms/1234")));
 }
 public void ShouldGenerateAbsoluteUriWithTerminatingBackslashWhenTemplateIsBackslash()
 {
     var uriFactory = new UriFactoryWorker("encounters", "/");
     Assert.AreEqual("http://restinpractice.com/encounters/", uriFactory.CreateAbsoluteUri(new Uri("http://restinpractice.com")).ToString());
 }
 public void ShouldGenerateAbsoluteUriFromBaseAddressAndRoutePrefixAndTempleAndTemplateParameters()
 {
     var uriFactory = new UriFactoryWorker("encounters", "{encounterId}/rounds/{roundId}");
     Assert.AreEqual("http://restinpractice.com/encounters/1/rounds/2", uriFactory.CreateAbsoluteUri(new Uri("http://restinpractice.com"), "1", "2").ToString());
 }
 public void ThrowsExceptionWhenSuppliedUriDoesNotContainRoutePrefix()
 {
     var uriFactory = new UriFactoryWorker("rooms", "{roomId}");
     uriFactory.CreateBaseUri(new Uri("http://restinpractice.com:8080/uk/encounters/1234"));
 }