示例#1
0
        public void IsNotCollectionOf()
        {
            var types = new[] {
                KV(typeof(IEnumerable <string>), typeof(int)),
                KV(typeof(IEnumerable), typeof(int)),
                KV(typeof(ArrayList), typeof(int)),
                KV(typeof(string), typeof(int)),
                KV(typeof(string), typeof(char)),
            };

            foreach (var t in types)
            {
                Assert.IsFalse(IndexController.IsCollectionOf(t.Key, t.Value), "Expected {0} is NOT collection of {1}", t.Key, t.Value);
            }
        }
示例#2
0
        public void IsCollectionOf()
        {
            var types = new[] {
                KV(typeof(IEnumerable <string>), typeof(string)),
                KV(typeof(IEnumerable <int>), typeof(int)),
                KV(typeof(ICollection <int>), typeof(int)),
                KV(typeof(List <int>), typeof(int)),
                KV(typeof(ISet <int>), typeof(int)),
                KV(typeof(HashedSet <int>), typeof(int)),
            };

            foreach (var t in types)
            {
                Assert.IsTrue(IndexController.IsCollectionOf(t.Key, t.Value), "Expected {0} is collection of {1}", t.Key, t.Value);
            }
        }