Пример #1
0
        public void Any()
        {
            Assert.ThrowsExact <ArgumentNullException>(() => Assert.Any(null as int[], v => v == 0));
            Assert.ThrowsExact <ArgumentNullException>(() => Assert.Any(new int[] { }, null));
            Assert.ThrowsExact <ArgumentException>(() => Assert.Any(new int[] { }, v => v == 0));

            Assert.DoesNotThrow(() => Assert.Any(new int[] { 1, 2, 3, 4, 5 }, v => v >= 3));
            Assert.DoesNotThrow(() => Assert.Any(new int[] { 1, 2, 3, 4, 5 }, v => v < 10));
            Assert.ThrowsExact <AssertionException>(() => Assert.Any(new int[] { 1, 2, 3, 4, 5 }, v => v > 10));
            Assert.DoesNotThrow(() => Assert.Any(new int[] { 1, 2, 3, 4, 5 }, v => v == 1));
        }