How do I write a unit test to test the UriTemplates (such as [WebGet(Uritemlpate="{clientId}/returns")]
in my WCF services?
For example, in Global.asax I have:
private void RegisterRoutes()
{
RouteTable.Routes.Add(new ServiceRoute("clients",
new WebServiceHostFactory(), typeof(ClientService)));
}
In the ClientService I have a [WebGet(Uritemlpate="uri_1")]
:
[ServiceContract]
public class ClientService
{
[WebGet(UriTemplate = "uri_1")]
public string GetCollection()
{
return "Method 1";
}
[WebGet(UriTemplate = "uri_2")]
public string GetCollections()
{
return "Method 2";
}
}
I want to have a test that Asserts the url clients/uri_1
hits exactly method GetCollection of ClientService.