예제 #1
0
        public void TestRenderingOfParamsUrlWithMultiParam()
        {
            var url = new Url();

            url.Value = new MockAttribute(new Constant("www.sharptiles.org"));

            var param1 = new Param();

            param1.Name = new MockAttribute(new Constant("p1"));
            param1.Body = new MockAttribute(new Constant("v1"));

            var param2 = new Param();

            param2.Name = new MockAttribute(new Constant("p2"));
            param2.Body = new MockAttribute(new Constant("v2"));

            var param3 = new Param();

            param3.Name = new MockAttribute(new Constant("p3"));
            param3.Body = new MockAttribute(new Constant("v3"));

            url.AddNestedTag(param1);
            url.AddNestedTag(param2);
            url.AddNestedTag(param3);
            Assert.That(url.Evaluate(new TagModel(this)), Is.EqualTo("www.sharptiles.org?p1=v1&p2=v2&p3=v3"));
        }
예제 #2
0
        public void TestRenderingOfParamsUrlInVariable()
        {
            var url = new Url();

            url.Value = new MockAttribute(new Constant("www.sharptiles.org"));

            var param1 = new Param();

            param1.Name = new MockAttribute(new Constant("p1"));
            param1.Body = new MockAttribute(new Constant("v1"));

            var param2 = new Param();

            param2.Name = new MockAttribute(new Constant("p2"));
            param2.Body = new MockAttribute(new Constant("v2"));

            url.AddNestedTag(param1);
            url.AddNestedTag(param2);

            url.Var = new MockAttribute(new Constant("target"));

            var model = new TagModel(this);

            Assert.That(url.Evaluate(model), Is.EqualTo(String.Empty));
            Assert.That(model.Page["target"], Is.EqualTo("www.sharptiles.org?p1=v1&p2=v2"));
        }
예제 #3
0
        public void TestRenderingOfParamsUrlWithOneParam()
        {
            var url = new Url();

            url.Value = new MockAttribute(new Constant("www.sharptiles.org"));

            var param = new Param();

            param.Name = new MockAttribute(new Constant("p1"));
            param.Body = new MockAttribute(new Constant("v1"));

            url.AddNestedTag(param);
            Assert.That(url.Evaluate(new TagModel(this)), Is.EqualTo("www.sharptiles.org?p1=v1"));
        }
예제 #4
0
        public void TestRenderingOfParamsUrlInVariableInDifferentScope()
        {
            var url = new Url();

            url.Value = new MockAttribute(new Constant("www.sharptiles.org"));

            var param1 = new Param();

            param1.Name = new MockAttribute(new Constant("p1"));
            param1.Body = new MockAttribute(new Constant("v1"));

            url.AddNestedTag(param1);

            url.Var   = new MockAttribute(new Constant("target"));
            url.Scope = new MockAttribute(new Constant("Session"));
            var model = new TagModel(this, new MockSessionState());

            Assert.That(url.Evaluate(model), Is.EqualTo(String.Empty));
            Assert.That(model.Session["target"], Is.EqualTo("www.sharptiles.org?p1=v1"));
        }
예제 #5
0
        public void TestRenderingOfParamsUrlInVariable()
        {
            var url = new Url();
            url.Value = new MockAttribute(new Constant("www.sharptiles.org"));

            var param1 = new Param();
            param1.Name = new MockAttribute(new Constant("p1"));
            param1.Body = new MockAttribute(new Constant("v1"));

            var param2 = new Param();
            param2.Name = new MockAttribute(new Constant("p2"));
            param2.Body = new MockAttribute(new Constant("v2"));

            url.AddNestedTag(param1);
            url.AddNestedTag(param2);

            url.Var = new MockAttribute(new Constant("target"));

            var model = new TagModel(this);
            Assert.That(url.Evaluate(model), Is.EqualTo(String.Empty));
            Assert.That(model.Page["target"], Is.EqualTo("www.sharptiles.org?p1=v1&p2=v2"));
        }
예제 #6
0
        public void TestRenderingOfParamsUrlWithTwoParams()
        {
            var url = new Url();
            url.Value = new MockAttribute(new Constant("www.sharptiles.org"));

            var param1 = new Param();
            param1.Name = new MockAttribute(new Constant("p1"));
            param1.Body = new MockAttribute(new Constant("v1"));

            var param2 = new Param();
            param2.Name = new MockAttribute(new Constant("p2"));
            param2.Body = new MockAttribute(new Constant("v2"));

            url.AddNestedTag(param1);
            url.AddNestedTag(param2);
            Assert.That(url.Evaluate(new TagModel(this)), Is.EqualTo("www.sharptiles.org?p1=v1&p2=v2"));
        }
예제 #7
0
        public void TestRenderingOfParamsUrlInVariableInDifferentScope()
        {
            var url = new Url();
            url.Value = new MockAttribute(new Constant("www.sharptiles.org"));

            var param1 = new Param();
            param1.Name = new MockAttribute(new Constant("p1"));
            param1.Body = new MockAttribute(new Constant("v1"));

            url.AddNestedTag(param1);

            url.Var = new MockAttribute(new Constant("target"));
            url.Scope = new MockAttribute(new Constant("Session"));
            var model = new TagModel(this, new MockSessionState());

            Assert.That(url.Evaluate(model), Is.EqualTo(String.Empty));
            Assert.That(model.Session["target"], Is.EqualTo("www.sharptiles.org?p1=v1"));
        }