Esempio n. 1
0
        public void CreatingAProperty_WithAttributes_AttributesCanBeQueried()
        {
            var property = new TestProperty()
                           .WithAttribute(new AttributeA {
                A = 1
            })
                           .WithAttribute(new AttributeB {
                B = 2
            })
                           .WithAttribute(new AttributeC {
                C = 3
            })
                           .WithAttribute(new AttributeA {
                A = 4
            });

            Assert.That(property.HasAttribute <AttributeA>(), Is.True);
            Assert.That(property.HasAttribute <AttributeB>(), Is.True);
            Assert.That(property.HasAttribute <AttributeC>(), Is.True);
            Assert.That(property.HasAttribute <ReadOnlyAttribute>(), Is.False);

            Assert.That(property.GetAttribute <AttributeA>().A, Is.EqualTo(1));

            Assert.That(property.GetAttributes <AttributeA>().Count(), Is.EqualTo(2));
        }