Ejemplo n.º 1
0
        public void IsArrayType()
        {
            Assert.ThrowsExact <ArgumentNullException>(() => Assert.IsArrayType(null as object));
            Assert.ThrowsExact <ArgumentNullException>(() => Assert.IsArrayType(null as Type));

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

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

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