Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        public void DotvvmRoute_BuildUrl_NoParameter()
        {
            var route = new DotvvmRoute("RR", null, null, null, configuration);

            var result = route.BuildUrl(null);

            Assert.AreEqual("~/RR", result);
        }
Esempio n. 6
0
        public void DotvvmRoute_BuildUrl_Invalid_UnclosedParameterConstraint()
        {
            Assert.ThrowsException <ArgumentException>(() => {
                var route = new DotvvmRoute("{Id:int", null, null, null, configuration);

                var result = route.BuildUrl(new { });
            });
        }
Esempio n. 7
0
        public void DotvvmRoute_BuildUrl_ParameterOnly()
        {
            var route = new DotvvmRoute("{Id?}", null, null, null, configuration);

            var result = route.BuildUrl(new { });

            Assert.AreEqual("~/", result);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        public void DotvvmRoute_BuildUrl_Static_OnePart()
        {
            var route = new DotvvmRoute("Article", null, null, null);

            var result = route.BuildUrl(new { });

            Assert.AreEqual("~/Article", result);
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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));
        }
Esempio n. 13
0
        public void DotvvmRoute_BuildUrl_Invalid_UnclosedParameterConstraint()
        {
            var route = new DotvvmRoute("{Id:int", null, null, null);

            var result = route.BuildUrl(new { });
        }