Exemplo n.º 1
0
        public void CreatorShouldAssembleFileTileWhenTileIsFilledShouldTakePrefixIntoAccount()
        {
            var config = new MockConfiguration()
            {
                Factory = _locatorFactory
            };

            _factory = new TilesFactory(config);
            var entry = new XmlAttributeEntry
            {
                Name  = "name",
                Value = "a.htm",
            };
            var tile = new AutoTileAttributeCreator().Create(entry, _factory);

            Assert.That(tile, Is.Not.Null);
            config.FilePrefix = @"nonexisting\";
            try
            {
                new AutoTileAttributeCreator().Create(entry, _factory);
            }
            catch (TileException Te)
            {
                Assert.That(Te.Message.Contains("not find a part of the path"));
            }
        }
Exemplo n.º 2
0
        public void CreatorShouldAssembleFileTileWhenTileIsFilledWithAnExistingFileName()
        {
            var entry = new XmlAttributeEntry
            {
                Name  = "name",
                Value = "a.htm",
            };
            TileAttribute tile = new AutoTileAttributeCreator().Create(entry, _factory);

            Assert.That(tile, Is.Not.Null);
            Assert.That(tile.Name, Is.EqualTo("name"));
            Assert.That(tile.Value, Is.Not.Null);
            Assert.That(tile.Value.GetType(), Is.EqualTo(typeof(TemplateTile)));
            var templateTile = (TemplateTile)tile.Value;
            var fileTemplate = (FileTemplate)templateTile.Template;

            Assert.That(fileTemplate.Path.EndsWith("a.htm"));
        }
Exemplo n.º 3
0
        public void CreatorShouldAssembleDefinitionTileWhenTileIsntAnExistingFileName()
        {
            var entry = new XmlAttributeEntry
            {
                Name  = "name",
                Value = "definition",
            };
            TileAttribute tile = new AutoTileAttributeCreator().Create(entry, _factory);

            Assert.That(tile, Is.Not.Null);
            Assert.That(tile.Name, Is.EqualTo("name"));
            Assert.That(tile.Value, Is.Not.Null);
            Assert.That(tile.Value.GetType(), Is.EqualTo(typeof(TileReference)));
            var reference = (TileReference)tile.Value;

            Assert.That(reference.FallBack, Is.Not.Null);
            Assert.That(reference.Name, Is.EqualTo("definition"));
            Assert.That(((StringTile)reference.FallBack).Value, Is.EqualTo("definition"));
        }