public void ParseString_Route_Success() { Assert.AreEqual(Constants.Route123, Route.Parse(string.Join(RouteFormatting.Default.Separator, Constants.String1, Constants.String2, Constants.String3))); Assert.AreEqual(Constants.Route1Dot2, Route.Parse(string.Join(RouteFormatting.Default.Separator, Constants.String1, RouteFormatting.EscapeSymbol + Constants.StringDot, Constants.String2))); var customFormatting = new RouteFormatting { Separator = "->" }; Assert.AreEqual(Constants.Route123, Route.Parse(string.Join(customFormatting.Separator, Constants.String1, Constants.String2, Constants.String3), customFormatting)); }
public void Formatting_Route_Success() { Assert.AreEqual(Constants.Route1.ToString(), Constants.String1); Assert.AreEqual(Constants.RouteDot.ToString(), RouteFormatting.EscapeSymbol + Constants.StringDot); Assert.AreEqual(Constants.Route12.ToString(), string.Join(RouteFormatting.Default.Separator, Constants.String1, Constants.String2)); Assert.AreEqual("*.**.*", Route.Create(Routes.Wildcard, Routes.WildcardRecursive, Routes.Wildcard).ToString()); var customFormatting = new RouteFormatting { Separator = "/" }; Assert.AreEqual(Constants.Route12.ToString(customFormatting), string.Join(customFormatting.Separator, Constants.String1, Constants.String2)); Assert.AreEqual(((IFormattable)Constants.Route12).ToString(null, customFormatting), string.Join(customFormatting.Separator, Constants.String1, Constants.String2)); Assert.AreEqual(((IFormattable)Constants.Route12).ToString("any", customFormatting), string.Join(customFormatting.Separator, Constants.String1, Constants.String2)); }