Exemple #1
0
        //[TestMethod]
        public void D_CreateXMLV3()
        {
            var database = new TVTDatabase();

            database.Initialize();

            var dataRoot = TVTDataRoot.V2InUse;

            using (var connection = TVTSQLSession.GetSessionNewDB())
            {
                var programmes = TVTCommandsV3.Read <TVTProgramme>(connection, TVTCommandsV3.GetProgrammeSQLDefinition(), "master_id, episode_index, fake_title_de, title_de");
                //database.AddProgrammes( programmes.Where( x => (int)x.DataStatus >= (int)TVTDataStatus.OnlyDE ) );
                //var yames = programmes.Where( x => x.FakeTitleDE != null && x.FakeTitleDE.StartsWith( "Yams Pond" ) ).ToList();
                //var yames2 = yames.Where( x => x.DataRoot == dataRoot ).ToList();
                database.AddProgrammes(programmes.Where(x => x.DataRoot == dataRoot));

                var ads = TVTCommandsV3.Read <TVTAdvertising>(connection, TVTCommandsV3.GetAdvertisingSQLDefinition(), "fake_title_de, title_de");
                database.AddAdvertisings(ads.Where(x => x.DataRoot == dataRoot));

                var people = TVTCommandsV3.Read <TVTPerson>(connection, TVTCommandsV3.GetPersonSQLDefinition(), "fake_last_name, fake_first_name, last_name");
                database.AddPeople(people.Where(x => x.DataRoot == dataRoot));

                var news = TVTCommandsV3.Read <TVTNews>(connection, TVTCommandsV3.GetNewsSQLDefinition(), "news_thread_id, news_type, title_de");
                database.AddNews(news.Where(x => x.DataRoot == dataRoot));

                database.RefreshReferences();
            }

            var persister = new XmlPersisterV3();

            persister.SaveXML(database, "TVTDatabaseV3.xml", DatabaseVersion.V3, DataStructure.FakeData, false);
        }
Exemple #2
0
        public void XMLV3ReadWriteTest()
        {
            TVTDatabase initialDatabase = new TVTDatabase();

            initialDatabase.Initialize();

            var advertising = EntityHelper.GetIconicAdvertising();

            initialDatabase.AddAdvertising(advertising);

            var person = EntityHelper.GetIconicPerson("Wurst", "Hans");

            initialDatabase.AddPerson(person);

            //var programme = EntityHelper.GetIconicProgramme();
            //initialDatabase.AddProgramme( programme );

            var persister = new XmlPersisterV3();

            persister.SaveXML(initialDatabase, "UnitTestXMLV2.xml", DatabaseVersion.V3, DataStructure.FakeData);

            TVTDatabase loadDatabase = new TVTDatabase();

            loadDatabase.Initialize();

            persister.LoadXML("UnitTestXMLV2.xml", loadDatabase, DataStructure.FakeData);

            Assert.AreEqual(1, loadDatabase.GetAllAdvertisings().Count());
            var loadAdvertising = loadDatabase.GetAllAdvertisings().First();

            AssertAdvertisings(advertising, loadAdvertising, TestMode.XMLV3);

            Assert.AreEqual(1, loadDatabase.GetAllPeople().Count());
            var loadPerson = loadDatabase.GetAllPeople().First();

            AssertPeople(person, loadPerson, TestMode.XMLV3, true);

            //Assert.AreEqual( 1, loadDatabase.GetAllProgrammes().Count() );
            //var loadProgrammes = loadDatabase.GetAllProgrammes().First();
            //AssertProgrammes( programme, loadProgrammes, TestMode.XMLV3 );
        }
Exemple #3
0
        public void SaveXMLFile( )
        {
            var persister = new XmlPersisterV3();

            persister.SaveXML(InternalDatabase, CurrentFilePath, DatabaseVersion.V3, DataStructure.FakeData, false);
        }
Exemple #4
0
        private void btnExcelExport_Click(object sender, EventArgs e)
        {
            XmlPersisterV3 persister = new XmlPersisterV3();

            persister.SaveXML(database, "ExportDatabaseFull.xml", DatabaseVersion.V3, DataStructure.Full);
        }
Exemple #5
0
        private void miExportV2Fake_Click(object sender, EventArgs e)
        {
            XmlPersisterV3 persister = new XmlPersisterV3();

            persister.SaveXML(database, "ExportTVTDatabaseV2Fake.xml", DatabaseVersion.V2, DataStructure.FakeData);
        }
Exemple #6
0
        private void miExportV3Original_Click(object sender, EventArgs e)
        {
            XmlPersisterV3 persister = new XmlPersisterV3();

            persister.SaveXML(database, "ExportTVTDatabaseV3Original.xml", DatabaseVersion.V3, DataStructure.OriginalData);
        }
Exemple #7
0
        private void miSaveAll_Click(object sender, EventArgs e)
        {
            XmlPersisterV3 persister = new XmlPersisterV3();

            persister.SaveXML(database, "TVTDatabaseV3Full.xml", DatabaseVersion.V3, DataStructure.Full);
        }
Exemple #8
0
        private void btnSaveOldFormat_Click(object sender, EventArgs e)
        {
            XmlPersisterV3 persister = new XmlPersisterV3();

            persister.SaveXML(database, "ExportDatabaseFakeDataOldFormat.xml", DatabaseVersion.V2, DataStructure.FakeData);
        }