コード例 #1
0
        public void Suppress_DoesSuppressDerivedAttribute_OnDifferentType()
        {
            AttributeWithMetadata[] attributes = new AttributeWithMetadata[] {
                new AttributeWithMetadata(typeof(object), new DerivedInheritedAttribute("X")),
            };
            AttributeWithMetadata[] suppressAttributes = new AttributeWithMetadata[] {
                new AttributeWithMetadata(typeof(string), new SuppressAttributesAttribute(typeof(BaseInheritedAttribute))),
            };
            AttributeWithMetadata[] expectedAttributes = new AttributeWithMetadata[] {
            };

            AttributeWithMetadata[] filteredAttributes = AttributeWithMetadata.Suppress(attributes, suppressAttributes).ToArray();
            Assert.That(filteredAttributes, Is.EqualTo(expectedAttributes));
        }
コード例 #2
0
        public void Suppress_DoesNotSuppressAnythingOnSameType()
        {
            AttributeWithMetadata[] attributes = new AttributeWithMetadata[] {
                new AttributeWithMetadata(typeof(object), new BaseInheritedAttribute("X")),
            };
            AttributeWithMetadata[] suppressAttributes = new AttributeWithMetadata[] {
                new AttributeWithMetadata(typeof(object), new SuppressAttributesAttribute(typeof(BaseInheritedAttribute))),
            };
            AttributeWithMetadata[] expectedAttributes = new AttributeWithMetadata[] {
                new AttributeWithMetadata(typeof(object), new BaseInheritedAttribute("X")),
            };

            AttributeWithMetadata[] filteredAttributes = AttributeWithMetadata.Suppress(attributes, suppressAttributes).ToArray();
            Assert.That(filteredAttributes, Is.EqualTo(expectedAttributes));
        }