示例#1
0
        public void InspectorRejectsBadGenArg()
        {
            var inspector = TypeInspectorComposer.CreateFor(typeof(List <int>));

            var result = inspector(typeof(List <float>));

            Assert.IsNull(result);
        }
示例#2
0
        public void InspectorRejectsBadNestedGenDef()
        {
            var inspector = TypeInspectorComposer.CreateFor(typeof(List <>).MakeGenericType(typeof(List <>)));

            var result = inspector(typeof(List <Nullable <int> >));

            Assert.IsNull(result);
        }
示例#3
0
        public void InspectorReturnsNullIfBadMatch()
        {
            var inspector = TypeInspectorComposer.CreateFor(typeof(int));

            var result = inspector(typeof(long));

            Assert.IsNull(result);
        }
示例#4
0
        public void InspectorReturnsNestedInPlaceGenArgument()
        {
            var inspector = TypeInspectorComposer.CreateFor(typeof(List <>).MakeGenericType(typeof(List <>)));

            var result = inspector(typeof(List <List <int> >));

            Assert.IsNotNull(result);
            Assert.IsTrue(result.SequenceEqual(new[] { typeof(int) }));
        }
示例#5
0
        public void InspectorReturnsEmptyEnumerationIfGoodSimpleMatch()
        {
            var inspector = TypeInspectorComposer.CreateFor(typeof(int));

            var result = inspector(typeof(int));

            Assert.IsNotNull(result);
            Assert.IsTrue(result.SequenceEqual(Enumerable.Empty <Type>()));
        }
示例#6
0
        public void InspectorReturnsGenArgModifiedByArray()
        {
            var protoType = typeof(Blah <>).GetInterfaces().Single();

            var inspector = TypeInspectorComposer.CreateFor(protoType);

            var result = inspector(typeof(IBlah <int[]>));

            Assert.IsNotNull(result);
            Assert.IsTrue(result.SequenceEqual(new[] { typeof(int) }));
        }