public void serializeTest() { JsonConversion jsonConversion = new JsonConversion(); State state = new State { VillageName = "villageName", DrawnItemsInformationList = new List <AgeOfVillagers.DrawnItemsInformation>() }; Assert.IsType <String>(jsonConversion.serialize(state)); }
public State saveVillage(State currentState, string villageName) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "save village|*.aov"; saveFileDialog1.Title = "Save village"; saveFileDialog1.ShowDialog(); objectToJson = new JsonConversion(); if (saveFileDialog1.FileName != "") { string json = objectToJson.serialize(currentState); System.IO.File.WriteAllText(saveFileDialog1.FileName, json); } return(currentState); }