Esempio n. 1
0
        /// <summary>
        /// Clears the loaded class definitions and reloads them.  Usually this only needs
        /// to be done once per test fixture, except if there are individual tests that
        /// modify the class definitions.
        /// </summary>
        public static void RefreshClassDefs()
        {
            ClassDef.ClassDefs.Clear();
//            ClassDefCol classDefs = new XmlClassDefsLoader(BOBroker.GetClassDefsXml(), new DtdLoader()).LoadClassDefs();
            var assemblyTypeSource = new AssemblyTypeSource(typeof(Car));
            var loader             = new ReflectionClassDefLoader(assemblyTypeSource);

            ClassDef.ClassDefs.Add(loader.LoadClassDefs());
        }
        public void TestAccept_LoadClassDefs_ShouldLoadAllClassDefs()
        {
            //---------------Set up test pack-------------------
            ITypeSource source = new AssemblyTypeSource(typeof(FakeExtBoShouldBeLoaded));
            IClassDefsLoader loader = new ReflectionClassDefLoader(source);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var defs = loader.LoadClassDefs();
            //---------------Test Result -----------------------
            AllClassesAutoMapper allClassesAutoMapper = new AllClassesAutoMapper(source);
            var expectedDefs = allClassesAutoMapper.Map();
            Assert.IsNotNull(defs);
            defs.ShouldHaveCount(expectedDefs.Count);
            defs.ShouldContain(expectedDefs, "Should contain all elements loaded via the mapper");
        }
        public void TestAccept_LoadClassDefs_ShouldLoadAllClassDefs()
        {
            //---------------Set up test pack-------------------
            ITypeSource      source = new AssemblyTypeSource(typeof(FakeExtBoShouldBeLoaded));
            IClassDefsLoader loader = new ReflectionClassDefLoader(source);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var defs = loader.LoadClassDefs();
            //---------------Test Result -----------------------
            AllClassesAutoMapper allClassesAutoMapper = new AllClassesAutoMapper(source);
            var expectedDefs = allClassesAutoMapper.Map();

            Assert.IsNotNull(defs);
            defs.ShouldHaveCount(expectedDefs.Count);
            defs.ShouldContain(expectedDefs, "Should contain all elements loaded via the mapper");
        }