コード例 #1
0
        public void IsNotEnumType()
        {
            Assert.ThrowsExact <ArgumentNullException>(() => Assert.IsNotEnumType(null as object));
            Assert.ThrowsExact <ArgumentNullException>(() => Assert.IsNotEnumType(null as Type));

            Assert.DoesNotThrow(() => Assert.IsNotEnumType("hello"));
            Assert.DoesNotThrow(() => Assert.IsNotEnumType(1L));
            Assert.ThrowsExact <AssertionException>(() => Assert.IsNotEnumType(AttributeTargets.All));
            Assert.DoesNotThrow(() => Assert.IsNotEnumType(new List <int>()));
            Assert.DoesNotThrow(() => Assert.IsNotEnumType(new int[0]));

            Assert.DoesNotThrow(() => Assert.IsNotEnumType <string>());
            Assert.DoesNotThrow(() => Assert.IsNotEnumType <long>());
            Assert.ThrowsExact <AssertionException>(() => Assert.IsNotEnumType <AttributeTargets>());
            Assert.DoesNotThrow(() => Assert.IsNotEnumType <List <int> >());
            Assert.DoesNotThrow(() => Assert.IsNotEnumType <int[]>());
            Assert.DoesNotThrow(() => Assert.IsNotEnumType <IEnumerable <int> >());

            Assert.DoesNotThrow(() => Assert.IsNotEnumType(typeof(string)));
            Assert.DoesNotThrow(() => Assert.IsNotEnumType(typeof(long)));
            Assert.ThrowsExact <AssertionException>(() => Assert.IsNotEnumType(typeof(AttributeTargets)));
            Assert.DoesNotThrow(() => Assert.IsNotEnumType(typeof(List <int>)));
            Assert.DoesNotThrow(() => Assert.IsNotEnumType(typeof(int[])));
            Assert.DoesNotThrow(() => Assert.IsNotEnumType(typeof(IEnumerable <int>)));
        }