コード例 #1
0
 public TileAttribute this[string name]
 {
     get
     {
         try
         {
             return(Attributes[name]);
         }
         catch (KeyNotFoundException)
         {
             throw TileException.AttributeNotFound(name, _definitionName);
         }
     }
 }
コード例 #2
0
        public void OnNonExistingAttributgesTagShouldThrowException()
        {
            var tag = new Insert
            {
                Name = new MockAttribute(new Constant("nonexisting"))
            };

            try
            {
                tag.Evaluate(_model);
                Assert.Fail("Expect exception");
            }
            catch (TileExceptionWithContext Te)
            {
                Assert.That(Te.Message, Is.EqualTo(TileException.AttributeNotFound("nonexisting", "main").Message));
            }
        }
コード例 #3
0
        public void TileAttributesShouldThrowExceptionOnNonExistingName()
        {
            var firstTile  = new TileAttribute("first", new StringTile("1"));
            var secondTile = new TileAttribute("second", new StringTile("2"));
            var set        = new AttributeSet("TILE", new List <TileAttribute> {
                firstTile, secondTile
            });

            try
            {
                Assert.That(set["nonexisting"], Is.Not.Null);
                Assert.Fail("Expected exception");
            } catch (TileException Te)
            {
                Assert.That(Te.Message, Is.EqualTo(TileException.AttributeNotFound("nonexisting", "TILE").Message));
            }
        }