Exemplo n.º 1
0
        public void createAugustus_withPlaceBornAndDeath_shouldCreate()
        {
            Place bornPlace = new Place
            {
                Name = "Rome"
            };
            Place deadPlace = new Place
            {
                Name = "Nola"
            };
            Person augustus = new Person
            {
                Name = "Augustus"
            };

            bornPlace.AddPerson(augustus);
            deadPlace.AddPersonDead(augustus);

            using (ISession session = sqliteSessionFactory.Session)
            {
                using (ITransaction transaction = session.BeginTransaction())
                {
                    Assert.That(augustus.Id == 0);


                    session.SaveOrUpdate(bornPlace);
                    session.SaveOrUpdate(deadPlace);
                    session.SaveOrUpdate(augustus);
                    transaction.Commit();

                    Assert.That(augustus.Id > 0);
                    Assert.That(augustus.BornPlace != null);
                    Assert.That(augustus.DeadPlace != null);
                }
            }
        }
Exemplo n.º 2
0
        private void buildToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool res = true;

            try
            {
                Place place_fl = new Place {
                    Name = "Florence"
                };
                Place place_rome = new Place {
                    Name = "Rome"
                };
                Place place_nola = new Place {
                    Name = "Nola"
                };
                Politician politician_augustus = new Politician
                {
                    Name = "Augustus"
                };
                Person claudia = new Person
                {
                    Name = "Claudia"
                };
                Person scribonia = new Person
                {
                    Name = "Scribonia"
                };
                Person livia = new Person
                {
                    Name = "Livia"
                };
                politician_augustus.AddSpouse(claudia);
                politician_augustus.AddSpouse(scribonia);
                politician_augustus.AddSpouse(livia);

                place_rome.AddPerson(politician_augustus);
                place_nola.AddPersonDead(politician_augustus);



                DBHelper.save <Politician>(politician_augustus);
                DBHelper.save <Person>(claudia);
                DBHelper.save <Person>(livia);
                DBHelper.save <Person>(scribonia);

                ComediaBuilder.build_places();
                ComediaBuilder.build_characters_bible();

                ComediaBuilder.build_poets_elite_six();
                ComediaBuilder.build_characters_aenaes();
                ComediaBuilder.build_characters_electra();
                ComediaBuilder.build_characters_minos();
                ComediaBuilder.build_characters_erinyes(); // three furies
                ComediaBuilder.build_politician();
                ComediaBuilder.build_characters_comedy();

                //ComediaBuilder.build_terms();
                //ComediaBuilder.build_metaphors_inferno();
                //ComediaBuilder.build_notes();
            }
            catch (Exception ex)
            {
                res = false;
            }
            SetResult("build characters: " + ((res == true) ? "ok" : "fail"));
        }