Esempio n. 1
0
        public void TearDown()
        {
            json_success.Value = "";
            json_success       = null;

            json_failure.Value = "";
            json_failure       = null;
        }
Esempio n. 2
0
        public void JSONSerialization()
        {
            TestJSON json_test = new TestJSON();

            json_test.Value = MSG_SUCCESS;

            string json_actual   = JsonConvert.SerializeObject(json_test);
            string json_expected = JsonConvert.SerializeObject(json_success);

            Assert.AreEqual(json_expected, json_actual);
        }
Esempio n. 3
0
 public void Setup()
 {
     json_success = new TestJSON()
     {
         Value = MSG_SUCCESS
     };
     json_failure = new TestJSON()
     {
         Value = MSG_FAILURE
     };
 }
Esempio n. 4
0
        public void JSONDeserialization()
        {
            // Construct a JSON success object.
            string json = @"{
    'Value': '" + MSG_SUCCESS + @"'
}";

            // Deserialize the test object.
            TestJSON json_test = JsonConvert.DeserializeObject <TestJSON>(json);

            // Check if values are equal.
            Assert.AreEqual(json_success.Value, json_test.Value);
            Assert.AreNotEqual(json_failure.Value, json_test.Value);
        }