public void CreatorShouldAssembleAStringTileWhenTileIsNeitherADefinitionOrAFile() { var entry = new XmlAttributeEntry { Name = "name", Value = "string", }; 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("string")); Assert.That(((StringTile) reference.FallBack).Value, Is.EqualTo("string")); }
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 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")); }