public void DotvvmRoute_BuildUrl_Static_TwoParts_TwoParameters_OneOptional_NoValue() { var route = new DotvvmRoute("Article/Test/{Id}/{Id2?}", null, null, null, configuration); var result = route.BuildUrl(new { Id = 5 }); Assert.AreEqual("~/Article/Test/5", result); }
public void DotvvmRoute_BuildUrl_Static_TwoParts_TwoParameters_OneOptional_WithValue_Suffix() { var route = new DotvvmRoute("Article/Test/{Id}/{Id2?}/suffix", null, null, null, configuration); var result = route.BuildUrl(new { Id = 5, Id2 = "aaa" }); Assert.AreEqual("~/Article/Test/5/aaa/suffix", result); }
public void DotvvmRoute_BuildUrl_UrlTwoParameters() { var route = new DotvvmRoute("Article/id_{Id}/{Title}", null, null, null, configuration); var result = route.BuildUrl(new { Id = 15, Title = "Test" }); Assert.AreEqual("~/Article/id_15/Test", result); }
public void DotvvmRoute_BuildUrl_Static_TwoParts() { var route = new DotvvmRoute("Article/Test", null, null, null, configuration); var result = route.BuildUrl(new { }); Assert.AreEqual("~/Article/Test", result); }
public void DotvvmRoute_BuildUrl_NoParameter() { var route = new DotvvmRoute("RR", null, null, null, configuration); var result = route.BuildUrl(null); Assert.AreEqual("~/RR", result); }
public void DotvvmRoute_BuildUrl_Invalid_UnclosedParameterConstraint() { Assert.ThrowsException <ArgumentException>(() => { var route = new DotvvmRoute("{Id:int", null, null, null, configuration); var result = route.BuildUrl(new { }); }); }
public void DotvvmRoute_BuildUrl_ParameterOnly() { var route = new DotvvmRoute("{Id?}", null, null, null, configuration); var result = route.BuildUrl(new { }); Assert.AreEqual("~/", result); }
public void DotvvmRoute_BuildUrl_Static_TwoParts_TwoParameters_FirstOptionalOptional_Suffix() { var route = new DotvvmRoute("Article/Test/{Id?}/{Id2}/suffix", null, null, null); var result = route.BuildUrl(new { Id2 = "aaa" }); Assert.AreEqual("~/Article/Test/aaa/suffix", result); }
public void DotvvmRoute_BuildUrl_Static_TwoParts_OptionalParameter_WithValue() { var route = new DotvvmRoute("Article/Test/{Id?}", null, null, null); var result = route.BuildUrl(new { Id = 5 }); Assert.AreEqual("~/Article/Test/5", result); }
public void DotvvmRoute_BuildUrl_Static_OnePart() { var route = new DotvvmRoute("Article", null, null, null); var result = route.BuildUrl(new { }); Assert.AreEqual("~/Article", result); }
public void DotvvmRoute_BuildUrl_CombineParameters_OneOptional() { var route = new DotvvmRoute("Article/{Id?}", null, null, null); var result = route.BuildUrl(new Dictionary <string, object>() { { "Id", 5 } }, new { }); Assert.AreEqual("~/Article/5", result); }
public void DotvvmRoute_BuildUrl_NullInParameter() { var route = new DotvvmRoute("myPage/{Id}/edit", null, null, null, configuration); var ex = Assert.ThrowsException <Exception>(() => { route.BuildUrl(new Dictionary <string, object> { ["Id"] = null }); }); Assert.IsInstanceOfType(ex.InnerException, typeof(ArgumentNullException)); }
public void DotvvmRoute_BuildUrl_Invalid_UnclosedParameterConstraint() { var route = new DotvvmRoute("{Id:int", null, null, null); var result = route.BuildUrl(new { }); }