public void DoesNotFindTypeInSeedAssembly() { Stub.On(dataTypeFactory).Method("Create").With(Is.Null).Will(Return.Value(dataType)); ITypeFinder finder = new TypeInReferencedAssemblyFinder(seedAssembly, typesCache, typeFinder, dataTypeFactory); finder.GetType(GetType().FullName); }
public void CanFindTypeInSecondReferencedAssembly() { Stub.On(dataTypeFactory).Method("Create").WithAnyArguments().Will(Return.Value(dataType)); Stub.On(typesCache).Method("Add").WithAnyArguments(); ITypeFinder finder = new TypeInReferencedAssemblyFinder(seedAssembly, typesCache, typeFinder, dataTypeFactory); Assert.AreSame(dataType, finder.GetType("NSerializer.TestAssembly2.TestTypeA2")); }
public void CanFindSystemTypeAndCachesTypeFound() { Stub.On(dataTypeFactory).Method("Create").With(typeof(Int32)).Will(Return.Value(dataType)); ITypeFinder finder = new TypeInReferencedAssemblyFinder(seedAssembly, typesCache, typeFinder, dataTypeFactory); Expect.Once.On(typesCache).Method("Add").With("System.Int32", typeof(Int32)); Assert.AreSame(dataType, finder.GetType("System.Int32")); }
private void CanFindType(Type soughtType) { Stub.On(dataTypeFactory).Method("Create").With(soughtType).Will(Return.Value(dataType)); Stub.On(typesCache).Method("Add").WithAnyArguments(); ITypeFinder finder = new TypeInReferencedAssemblyFinder(seedAssembly, typesCache, typeFinder, dataTypeFactory); Assert.AreSame(dataType, finder.GetType(soughtType.FullName)); }
public void CanFindArrayType() { Stub.On(dataTypeFactory).Method("Create").With(typeof(TestTypeA1[])).Will(Return.Value(dataType)); Stub.On(dataType).GetProperty("IsArray").Will(Return.Value(true)); Stub.On(typesCache).Method("Add").WithAnyArguments(); ITypeFinder finder = new TypeInReferencedAssemblyFinder(seedAssembly, typesCache, typeFinder, dataTypeFactory); var type = finder.GetType("NSerializer.TestAssembly1.TestTypeA1[]"); Assert.IsNotNull(type); Assert.IsTrue(type.IsArray); }