Пример #1
0
        public void validate_deserialization_of_SimulationInput_from_file()
        {
            VtsJsonSerializer.WriteToJsonFile(new SimulationInput(), "VtsJsonSerializerTests_file3.txt");
            var objectDeserialized = VtsJsonSerializer.ReadFromJsonFile <SimulationInput>("VtsJsonSerializerTests_file3.txt");

            Assert.IsTrue(objectDeserialized != null);
        }
Пример #2
0
        public void validate_deserialization_from_file()
        {
            VtsJsonSerializer.WriteToJsonFile(new[] { "Hello", "Sailor" }, "VtsJsonSerializerTests_file2.txt");
            var objectDeserialized = VtsJsonSerializer.ReadFromJsonFile <string[]>("VtsJsonSerializerTests_file2.txt");

            Assert.IsTrue(objectDeserialized != null);
            Assert.IsTrue(objectDeserialized.Length > 0);
            Assert.AreEqual(objectDeserialized[0], "Hello");
            Assert.AreEqual(objectDeserialized[1], "Sailor");
        }
Пример #3
0
 public static void WriteToJsonFile <T>(this T myObject, string filename)
 {
     VtsJsonSerializer.WriteToJsonFile(myObject, filename);
 }
Пример #4
0
 public void validate_file_exists_after_writing()
 {
     VtsJsonSerializer.WriteToJsonFile(new[] { "Hello", "World" }, "VtsJsonSerializerTests_file1.txt");
     Assert.IsTrue(FileIO.FileExists("VtsJsonSerializerTests_file1.txt"));
 }