diff --git a/WebApi.Hal.Tests/UriBuilderTests.cs b/WebApi.Hal.Tests/UriBuilderTests.cs
index 8251ff0..20c6140 100644
--- a/WebApi.Hal.Tests/UriBuilderTests.cs
+++ b/WebApi.Hal.Tests/UriBuilderTests.cs
@@ -111,5 +111,18 @@ public void create_uri_absolute()
// assert
Assert.Equal("http://myserver.com/api/beers/BeerName", link.ToString());
}
+
+ [Fact]
+ public void create_link_uses_templates_title()
+ {
+ // arrange
+ var templateLink = new Link("beerbyname", "http://myserver.com/api/beers{name}", "Beer");
+
+ // act
+ var link = templateLink.CreateLink(new {name = "BeerName"});
+
+ // assert
+ Assert.Equal(link.Title, "Beer");
+ }
}
}
\ No newline at end of file
diff --git a/WebApi.Hal/Link.cs b/WebApi.Hal/Link.cs
index 889eda5..4457c99 100644
--- a/WebApi.Hal/Link.cs
+++ b/WebApi.Hal/Link.cs
@@ -34,7 +34,7 @@ public bool IsTemplated
/// A non templated link
public Link CreateLink(string newRel, params object[] parameters)
{
- return new Link(newRel, CreateUri(parameters).ToString());
+ return new Link(newRel, CreateUri(parameters).ToString(), Title);
}
///