コード例 #1
0
        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);
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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);
        }