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

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

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

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