Ejemplo n.º 1
0
        public void ItIsNotPossibleToleaveStreetNameBlank()
        {
            Assert.Catch(() =>
                {
                    var x = new House(11,"","Hummer");

                });
        }
Ejemplo n.º 2
0
        public void ItIsNotPossibleToleaveFamilieNameBlank()
        {
            Assert.Catch(() =>
                {
                    var x = new House(11,"Hauptstraße","");

                });
        }
Ejemplo n.º 3
0
        public void ItIsNotPossibleToCreateNegativHouseNumbers()
        {
            Assert.Catch(() =>
                {
                    var x = new House(-11,"Hauptstraße","Hummer");

                });
        }
Ejemplo n.º 4
0
 public void CanGetFamilieName()
 {
     var x = new House(11,"Hauptstraße","Hummer");
     Assert.IsTrue (x.getFamilieName() == "Hummer");
 }
Ejemplo n.º 5
0
 public void CanCreateHouse()
 {
     var x = new House(11,"Hauptstraße","Hummer");
     Assert.IsTrue(x.house_nr == 11);
     Assert.IsTrue(x.street == "Hauptstraße");
 }
Ejemplo n.º 6
0
        public static void Main(string[] args)
        {
            House myhouse = new House(11,"Hauptstraße","Hummer");

            Console.WriteLine ("\n\nHAUS_NR: {0}  STRASSE: {1}  Fam.Name: {2}\n\n",myhouse.house_nr,myhouse.street,myhouse.getFamilieName());

            Console.WriteLine ("Fam.Name geaendert auf: {0}",myhouse.setFamilieName("Baglawatsch"));

            Console.WriteLine ("\n\nHAUS_NR: {0}  STRASSE: {1}  Fam.Name: {2}\n\n",myhouse.house_nr,myhouse.street,myhouse.getFamilieName());

            Adds add1 = new Adds (12, "Uferstraße", "Neumaier", "Obbi");
            Adds add2 = new Adds (13, "Bahnstraße", "Hugo", "Billa");

            add1.get_adds();
            add2.get_adds();

            /*
            var items = new ICity[]
            {
                new House(1,"Hauptstraße","Hummer"),
                new House(5,"Bahnstraße","Sabeditsch"),
                new House(14,"Bahnstraße","Sabeditsch"),
                new Adds (12, "Uferstraße", "Neumaier", "Obbi"),
                new Adds (13, "Bahnstraße", "Hugo", "Billa"),

            };
            */

            var items2 = new House[]
            {
                new House(1,"Hauptstraße","Hummer"),
                new House(5,"Bahnstraße","Sabeditsch"),
                new House(14,"Bahnstraße","Sabeditsch"),

            };

            var settings1 = new JsonSerializerSettings() { Formatting = Formatting.Indented, TypeNameHandling = TypeNameHandling.Auto };
            Console.WriteLine(JsonConvert.SerializeObject(items2, settings1));

            //string json = JsonConvert.SerializeObject(items2, settings1);

            //Console.WriteLine (json);

            // serialize JSON to a string and then write string to a file
            File.WriteAllText("/Users/gerhard/Downloads/temp_test1.txt", JsonConvert.SerializeObject(items2,settings1));

            var textFromFile = File.ReadAllText("/Users/gerhard/Downloads/temp_test1.txt");
            var re_items = JsonConvert.DeserializeObject<House[]>(textFromFile, settings1);

            Console.WriteLine ("\n\n{0}", re_items[0].house_nr);
        }