Exemple #1
0
        public void Refresh()
        {
            ITileEntry a = new MockTileEntry
            {
                Name = "a",
                Path = _tempTile
            };
            ITileEntry b = new MockTileEntry
            {
                Name = "b",
                Path = "b.htm"
            };

            _configuration = new List <ITileEntry>();
            _configuration.Add(a);
            _configuration.Add(b);
            if (_addC)
            {
                _configuration.Add(new MockTileEntry
                {
                    Name = "c",
                    Path = "c.htm"
                });
            }
        }
        public void CreateShouldAssembleFileTileWithCorrectExtends()
        {
            //            var set = new TilesMap();
            //            set.AddTile(new FileTile(
            //                            "definition",
            //                            "a.htm",
            //                            null
            //                            )
            //                );
            var factory = new TilesFactory(new MockConfiguration());

            var entry = new MockTileEntry
                            {
                                Name = "name",
                                Path = null,
                                Extends = "definition"
                            };
            ITile tile = new DefinitionTileCreator().Create(entry, factory);
            Assert.That(tile, Is.Not.Null);
            Assert.That(tile.GetType(), Is.EqualTo(typeof (DefinitionTile)));
            Assert.That(tile.Name, Is.EqualTo("name"));

            var definition = (DefinitionTile) tile;
            Assert.That(definition.Extends, Is.Not.Null);
            Assert.That(definition.Extends.GetType(), Is.EqualTo(typeof (TileReference)));

            var reference = (TileReference) definition.Extends;
            Assert.That(reference.Name, Is.EqualTo("definition"));
        }
 public void CreateShouldAssembleFileTileWithCorrectPath()
 {
     var lib = new TagLib();
     lib.Register(new Tags.Tiles());
     lib.Register(new Sharp());
     var locatorFactory = new FileLocatorFactory().CloneForTagLib(lib) as FileLocatorFactory;
     var factory = new TilesFactory(new MockConfiguration("x", DateTime.Now) {Factory = locatorFactory });
     var entry = new MockTileEntry
                     {
                         Name = "name",
                         Path = "a.htm",
                         Extends = null
                     };
     var tile = new TemplateTileCreator().Create(entry, factory);
     Assert.That(tile, Is.Not.Null);
     Assert.That(tile.GetType(), Is.EqualTo(typeof (TemplateTile)));
     Assert.That(tile.Name, Is.EqualTo("name"));
     var templateTile = (TemplateTile) tile;
     var fileTemplate = (FileTemplate) templateTile.Template;
     Assert.That(fileTemplate.Path.EndsWith("a.htm"));
 }
        public void CreateShouldAssembleFileTileWithCorrectExtendsAndPath()
        {
            var lib = new TagLib();
            lib.Register(new Tags.Tiles());
            lib.Register(new Sharp());
            var locatorFactory = new FileLocatorFactory().CloneForTagLib(lib) as FileLocatorFactory;
            var factory = new TilesFactory( new MockConfiguration("a", DateTime.Now) {Factory = locatorFactory });

            var entry = new MockTileEntry
                            {
                                Name = "name",
                                Path = "b.htm",
                                Extends = "definition"
                            };
            ITile tile = new TemplateOverridingDefinitionTileCreator().Create(entry, factory);
            Assert.That(tile, Is.Not.Null);
            Assert.That(tile.GetType(), Is.EqualTo(typeof(TemplateOveridingDefinitionTile)));
            Assert.That(tile.Name, Is.EqualTo("name"));

            var definition = (TemplateOveridingDefinitionTile)tile;
            var tileTemplate = (FileTemplate)definition.Template;

            Assert.That(tileTemplate.Path.EndsWith("b.htm"));

            Assert.That(definition.Extends, Is.Not.Null);
            Assert.That(definition.Extends.GetType(), Is.EqualTo(typeof (TileReference)));

            var reference = (TileReference) definition.Extends;
            Assert.That(reference.Name, Is.EqualTo("definition"));
        }
 public void Refresh()
 {
     ITileEntry a = new MockTileEntry
                        {
                            Name = "a",
                            Path = _tempTile
                        };
     ITileEntry b = new MockTileEntry
                        {
                            Name = "b",
                            Path = "b.htm"
                        };
     _configuration = new List<ITileEntry>();
     _configuration.Add(a);
     _configuration.Add(b);
     if(_addC)
     {
         _configuration.Add(new MockTileEntry
         {
             Name = "c",
             Path = "c.htm"
         });
     }
 }