Пример #1
0
        public void TestAllGeneric()
        {
            object[] test = null;

            // test null check
            Assert.True(Adapters.All <object>(test));
            Assert.True(test.All <object>());

            // test adaptation failure
            test = new object[1];
            Assert.False(Adapters.All <object>(test));
            Assert.False(test.All <object>());

            // test adaptation success
            test = new object[] { "a", "b" };
            Assert.True(Adapters.All <string>(test));
            Assert.True(test.All <string>());

            // test adaptation success/failure
            test = new object[] { "a", this };
            Assert.False(Adapters.All <string>(test));
            Assert.False(test.All <string>());
        }
Пример #2
0
        public void TestAll()
        {
            object[] test = null;

            // test null check
            Assert.True(Adapters.All(test, typeof(object)));
            Assert.True(test.All(typeof(object)));

            // test adaptation failure
            test = new object[1];
            Assert.False(Adapters.All(test, typeof(object)));
            Assert.False(test.All(typeof(object)));

            // test adaptation success
            test = new object[] { "a", "b" };
            Assert.True(Adapters.All(test, typeof(string)));
            Assert.True(test.All(typeof(string)));

            // test adaptation success/failure
            test = new object[] { "a", this };
            Assert.False(Adapters.All(test, typeof(string)));
            Assert.False(test.All(typeof(string)));
        }