Ejemplo n.º 1
0
        public void DataMigration7000020Test()
        {
            var dtos = DataMigrationTestServices.ParseProjectFile("DataMigration7000020.xml");

            IFwMetaDataCacheManaged mockMdc = SetupMdc();

            IDomainObjectDTORepository repoDto = new DomainObjectDtoRepository(7000019, dtos, mockMdc,
                                                                               Path.GetTempPath(), TestDirectoryFinder.LcmDirectories);

            // Initial check that data was read properly.
            var cObjects = repoDto.AllInstances().Count();

            Assert.AreEqual(378, cObjects, "Before migrating, should be 378 objects");
            var cLangProject = repoDto.AllInstancesSansSubclasses("LangProject").Count();

            Assert.AreEqual(1, cLangProject, "Before migrating, should be 1 LangProject object");
            var cUserView = repoDto.AllInstancesSansSubclasses("UserView").Count();

            Assert.AreEqual(17, cUserView, "Before migrating, should be 17 UserView objects");
            var cUserViewRec = repoDto.AllInstancesSansSubclasses("UserViewRec").Count();

            Assert.AreEqual(31, cUserViewRec, "Before migrating, should be 31 UserViewRec objects");
            var cUserViewField = repoDto.AllInstancesSansSubclasses("UserViewField").Count();

            Assert.AreEqual(329, cUserViewField, "Before migrating, should be 329 UserViewField objects");

            // Do the migration.
            m_dataMigrationManager.PerformMigration(repoDto, 7000020, new DummyProgressDlg());

            // Verification Phase
            Assert.AreEqual(7000020, repoDto.CurrentModelVersion, "Wrong updated version.");
            cObjects = repoDto.AllInstances().Count();
            Assert.AreEqual(31, cObjects, "After migrating, should be 31 objects");
            cLangProject = repoDto.AllInstancesSansSubclasses("LangProject").Count();
            Assert.AreEqual(1, cLangProject, "After migrating, should be 1 LangProject object");
            cUserView = repoDto.AllInstancesSansSubclasses("UserView").Count();
            Assert.AreEqual(12, cUserView, "After migrating, should be 12 UserView objects");
            cUserViewRec = repoDto.AllInstancesSansSubclasses("UserViewRec").Count();
            Assert.AreEqual(3, cUserViewRec, "After migrating, should be 3 UserViewRec objects");
            cUserViewField = repoDto.AllInstancesSansSubclasses("UserViewField").Count();
            Assert.AreEqual(15, cUserViewField, "After migrating, should be 15 UserViewField objects");
        }