System.Tests.GetCustomAttribute.NegTest3 C# (CSharp) Method

NegTest3() private method

private NegTest3 ( ) : void
return void
        public static void NegTest3()
        {
            MemberInfo element = null;
            Type attributeType = typeof(ObsoleteAttribute);
            Type clsType = typeof(DerivedClass);

            Assert.Throws<ArgumentNullException>(() => (ObsoleteAttribute)Attribute.GetCustomAttribute(element, attributeType));
            attributeType = null;
            element = typeof(TestClass).GetMethod("method1");
            Assert.Throws<ArgumentNullException>(() => (ObsoleteAttribute)Attribute.GetCustomAttribute(element, attributeType));
            attributeType = typeof(object);
            Assert.Throws<ArgumentException>(() => Attribute.GetCustomAttribute(element, attributeType));

            Assert.Throws<AmbiguousMatchException>(() => Attribute.GetCustomAttribute(typeof(Attribute).GetMethod("GetCustomAttribute"), typeof(Attribute)));

        }
        [Fact]