public void ItIsNotPossibleToleaveAddsFamNameBlank() { Assert.Catch(() => { var x = new Adds(11,"Hauptstraße","","Billa"); }); }
public void CanCreateAdds() { var x = new Adds(11,"Hauptstraße","Hummer","Billa"); Assert.IsTrue(x.house_nr == 11); Assert.IsTrue(x.street == "Hauptstraße"); Assert.IsTrue(x.getFamilieName() == "Hummer"); Assert.IsTrue(x.get_adds() == "Billa"); }
public void ItIsNotPossibleToleaveAddsBlank() { Assert.Catch(() => { var x = new Adds(11,"Hauptstraße","Hummer",""); }); }
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); }