Exemple #1
0
        public void InsertTemplateWithUrlAttribute()
        {
            var tag = new InsertTemplate()
            {
                Template = new MockAttribute(new Constant("insertDMaster.htm"))
            };

            tag.Factory = _factory;
            var moduleAttribute = new PutAttribute()
            {
                Name  = new MockAttribute(new Constant("modules")),
                Value = new MockAttribute(new Constant("insertDAdditional.htm"))
            };

            tag.AddNestedTag(moduleAttribute);
            var bodyAttribute = new PutAttribute()
            {
                Name  = new MockAttribute(new Constant("body")),
                Value = new MockAttribute(new Constant("Dit is de Test Body"))
            };

            tag.AddNestedTag(bodyAttribute);
            string expected = (new StreamReader("insertDExpected.htm")).ReadToEnd();
            string value    = tag.Evaluate(_model);

            Assert.That(value, Is.EqualTo(expected));
        }
        public void PutAttribute()
        {
            var attribute = new PutAttribute("foo");
            var route     = attribute.BuildRoute(null);

            route.Pattern.ShouldBe("foo");
            route.AllowedHttpMethods.ShouldHaveTheSameElementsAs("PUT");
        }
Exemple #3
0
        public void RouteShouldReturnTheRoutePassedInToTheConstructor()
        {
            const string Route = "example/route";

            var attribute = new PutAttribute(Route);

            Assert.That(attribute.Route, Is.EqualTo(Route));
        }
Exemple #4
0
        public void InsertTemplateWithOneSimpleAttribute()
        {
            var tag = new InsertTemplate()
            {
                Template = new MockAttribute(new Constant("insertBMaster.htm"))
            };

            tag.Factory = _factory;
            var titleAttribute = new PutAttribute()
            {
                Name  = new MockAttribute(new Constant("title")),
                Value = new MockAttribute(new Constant("Dit is de Test Title"))
            };

            tag.AddNestedTag(titleAttribute);
            string expected = (new StreamReader("insertBExpected.htm")).ReadToEnd();
            string value    = tag.Evaluate(_model);

            Assert.That(value, Is.EqualTo(expected));
        }
Exemple #5
0
        public void InsertTemplateCachesTile()
        {
            var tag = new InsertTemplate()
            {
                Template = new MockAttribute(new Constant("insertEMaster.htm"))
            };

            tag.Factory = _factory;
            var bodyAttribute = new PutAttribute()
            {
                Name = new MockAttribute(new Constant("body")),
                Body = new MockAttribute(new Constant("Dit is de Test Body"))
            };

            tag.AddNestedTag(bodyAttribute);
            tag.Evaluate(_model);
            var tile = tag.Tile;

            tag.Evaluate(_model);
            Assert.That(tag.Tile, Is.SameAs(tile));
        }
Exemple #6
0
        public void VerbShouldReturnPUT()
        {
            var attribute = new PutAttribute(string.Empty);

            Assert.That(attribute.Verb, Is.EqualTo("PUT"));
        }