public void Root_Test()
        {
            var root = RouteTemplateNode <object> .CreateRoot();

            Assert.IsNull(root.Parent);
            Assert.AreEqual(string.Empty, root.Value);
            Assert.AreEqual(RouteTemplateNodeType.Literal, root.TemplateNodeType);
        }
        public void Literal_Test(string literalSegment)
        {
            var root = RouteTemplateNode <object> .CreateRoot();

            var child = root.AddChild(literalSegment);

            Assert.AreEqual(root, child.Parent);
            Assert.AreEqual(literalSegment, child.Value);
            Assert.AreEqual(RouteTemplateNodeType.Literal, child.TemplateNodeType);
        }
        public void CatchAll_Test(string catchAllSegment)
        {
            var catchAllValue = catchAllSegment.Substring(2, catchAllSegment.Length - 3);
            var root          = RouteTemplateNode <object> .CreateRoot();

            var child = root.AddChild(catchAllSegment);

            Assert.AreEqual(root, child.Parent);
            Assert.AreEqual(catchAllValue, child.Value);
            Assert.AreEqual(RouteTemplateNodeType.CatchAll, child.TemplateNodeType);
        }
        public void Parameter_Test(string parameterSegment)
        {
            var parameterValue = parameterSegment.Substring(1, parameterSegment.Length - 2);
            var root           = RouteTemplateNode <object> .CreateRoot();

            var child = root.AddChild(parameterSegment);

            Assert.AreEqual(root, child.Parent);
            Assert.AreEqual(parameterValue, child.Value);
            Assert.AreEqual(RouteTemplateNodeType.Parameter, child.TemplateNodeType);
        }
        public void EmptySegment_Must_Throw_Exception()
        {
            var root = RouteTemplateNode <object> .CreateRoot();

            Assert.ThrowsException <ArgumentException>(() => root.AddChild(""));
        }