public void CanReplaceParameter1() { var urlTemplate = string.Format("/SampleController/SampleAction/{0}", UrlTemplate.Parameter1Int); var template = new UrlTemplate <int>(urlTemplate); const int realParameter1 = 123; var result = template.ParameterReplace(realParameter1); Assert.That(result, Is.EqualTo(urlTemplate.Replace(UrlTemplate.Parameter1Int.ToString(), realParameter1.ToString())), "Should be able to replace with 1 parameter"); }
public void CanReplaceParameter2() { var urlTemplate = string.Format("/SampleController/SampleAction/{0}/{1}", UrlTemplate.Parameter1Int, UrlTemplate.Parameter2String); var template = new UrlTemplate <int, string>(urlTemplate); const int realParameter1 = 123; const string realParameter2 = "hi"; var result = template.ParameterReplace(realParameter1, realParameter2); var expected = urlTemplate.Replace(UrlTemplate.Parameter1Int.ToString(), realParameter1.ToString()).Replace(UrlTemplate.Parameter2String, realParameter2); Assert.That(result, Is.EqualTo(expected), "Should be able to replace with 2 parameters"); }