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 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 static TilesFactory AssembleFor(IConfiguration config) { var factory = new TilesFactory(config); factory.Decorate(); return(factory); }
public ITile Create(ITileEntry entry, TilesFactory factory) { return new TemplateOveridingDefinitionTile(entry.Name, factory.GetTemplate(entry, true), new TileReference(entry.Extends, factory.Map), factory.CreateAttributes(entry)); }
public ITile Create(ITileEntry entry, TilesFactory factory) { return(new TemplateOveridingDefinitionTile(entry.Name, factory.GetTemplate(entry, true), new TileReference(entry.Extends, factory.Map), factory.CreateAttributes(entry))); }
public TileAttribute Create(IAttributeEntry entry, TilesFactory factory) { var template = factory.GetTemplate(entry, false); if (template!=null) { return new TileAttribute(entry.Name, new TemplateTile(null, template, null)); } return new TileAttribute(entry.Name, new TileReference(entry.Value, factory.Map, new StringTile(entry.Value))); }
public TileAttribute Create(IAttributeEntry entry, TilesFactory factory) { var template = factory.GetTemplate(entry, false); if (template != null) { return(new TileAttribute(entry.Name, new TemplateTile(null, template, null))); } return(new TileAttribute(entry.Name, new TileReference(entry.Value, factory.Map, new StringTile(entry.Value)))); }
public void CreatorShouldAssembleTileAttributeWithEmbeddedDefinitionTile() { var factory = new TilesFactory(new MockConfiguration()); var entry = new XmlAttributeEntry { Name = "name", Value = "definition", Type = TileType.Definition.ToString() }; TileAttribute tile = new DefinitionTileAttributeCreator().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))); Assert.That(((TileReference) tile.Value).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 CreatorShouldAssembleTileAttributeShoulApplyFilePrefix() { var entry = new XmlAttributeEntry { Name = "name", Value = "a.htm", Type = TileType.File.ToString() }; var config = new MockConfiguration("a.htm", DateTime.Now) { Factory = _locatorFactory }; var factory = new TilesFactory(config); var tile = new TemplateTileAttributeCreator().Create(entry, factory); Assert.That(tile, Is.Not.Null); config.FilePrefix = @"nonexisting\"; try { new TemplateTileAttributeCreator().Create(entry, factory); } catch (TileException Te) { Console.WriteLine(Te.Message); Assert.That(Te.Message.Contains("a.htm could not be found")); } }
public ITile Create(ITileEntry entry, TilesFactory factory) { return new TemplateTile(entry.Name, factory.GetTemplate(entry, true), factory.CreateAttributes(entry)); }
public TileAttribute Create(IAttributeEntry entry, TilesFactory factory) { return new TileAttribute(entry.Name, new TemplateTile(null, factory.GetTemplate(entry, true), null)); }
public TileAttribute Create(IAttributeEntry entry, TilesFactory factory) { return new TileAttribute(entry.Name, new StringTile(entry.Value)); }
public static TilesFactory AssembleFor(IConfiguration config) { var factory = new TilesFactory(config); factory.Decorate(); return factory; }
public TileAttribute Create(IAttributeEntry entry, TilesFactory factory) { return(new TileAttribute(entry.Name, new TileReference(entry.Value, factory.Map))); }
public void CreatorShouldAssembleTileAttributeWithEmbeddedFileTile() { var entry = new XmlAttributeEntry { Name = "name", Value = "a.htm", Type = TileType.File.ToString() }; var factory = new TilesFactory(new MockConfiguration("a.htm", DateTime.Now) {Factory = _locatorFactory }); var tile = new TemplateTileAttributeCreator().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 template = (FileTemplate) templateTile.Template; Assert.That(template.Path.EndsWith("a.htm")); }
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")); } }
public ITile Create(ITileEntry entry, TilesFactory factory) { return(new TemplateTile(entry.Name, factory.GetTemplate(entry, true), factory.CreateAttributes(entry))); }
public ITile Create(ITileEntry entry, TilesFactory factory) { return new DefinitionTile(entry.Name, new TileReference(entry.Extends, factory.Map), factory.CreateAttributes(entry)); }
public TileAttribute Create(IAttributeEntry entry, TilesFactory factory) { return(new TileAttribute(entry.Name, new TemplateTile(null, factory.GetTemplate(entry, true), null))); }
public TileAttribute Create(IAttributeEntry entry, TilesFactory factory) { return new TileAttribute(entry.Name, new TileReference(entry.Value, factory.Map)); }
public void SetUp() { _lib = new TagLib(); _lib.Register(new Tags.Tiles()); _lib.Register(new Sharp()); _locatorFactory = new FileLocatorFactory().CloneForTagLib(_lib) as FileLocatorFactory; var config = new MockConfiguration() {Factory = _locatorFactory }; _factory = new TilesFactory(config); }
public TileAttribute Create(IAttributeEntry entry, TilesFactory factory) { return(new TileAttribute(entry.Name, new StringTile(entry.Value))); }
public ITile Create(ITileEntry entry, TilesFactory factory) { return(new DefinitionTile(entry.Name, new TileReference(entry.Extends, factory.Map), factory.CreateAttributes(entry))); }
public void TearDown() { _factory = null; }