public void InspectorRejectsBadGenArg() { var inspector = TypeInspectorComposer.CreateFor(typeof(List <int>)); var result = inspector(typeof(List <float>)); Assert.IsNull(result); }
public void InspectorRejectsBadNestedGenDef() { var inspector = TypeInspectorComposer.CreateFor(typeof(List <>).MakeGenericType(typeof(List <>))); var result = inspector(typeof(List <Nullable <int> >)); Assert.IsNull(result); }
public void InspectorReturnsNullIfBadMatch() { var inspector = TypeInspectorComposer.CreateFor(typeof(int)); var result = inspector(typeof(long)); Assert.IsNull(result); }
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) })); }
public void InspectorReturnsEmptyEnumerationIfGoodSimpleMatch() { var inspector = TypeInspectorComposer.CreateFor(typeof(int)); var result = inspector(typeof(int)); Assert.IsNotNull(result); Assert.IsTrue(result.SequenceEqual(Enumerable.Empty <Type>())); }
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) })); }