示例#1
0
        public void Clone()
        {
            string modelPath = Path.Combine(Directory.GetCurrentDirectory(), "../../../Machine/JSON/model.json");
            string jsonText  = System.IO.File.ReadAllText(modelPath);

            using JsonDocument parsedJson = JsonDocument.Parse(jsonText);

            ObjectModel model = new ObjectModel();

            model.UpdateFromJson(parsedJson.RootElement);

            ObjectModel newModel = (ObjectModel)model.Clone();

            string serializedModel = newModel.ToString();

            Assert.AreEqual(jsonText, serializedModel);
        }