Example #1
0
        public void RawToObject()
        {
            JRaw r1 = new JRaw("1");
            int i = r1.ToObject<int>();

            Assert.Equal(1, i);
        }
Example #2
0
        public void RawClone()
        {
            JRaw r1 = new JRaw("raw1");
            JToken r2 = r1.CloneToken();

            Assert.IsType(typeof(JRaw), r2);
        }
Example #3
0
        public void RawEquals()
        {
            JRaw r1 = new JRaw("raw1");
            JRaw r2 = new JRaw("raw1");
            JRaw r3 = new JRaw("raw2");

            Assert.True(JToken.DeepEquals(r1, r2));
            Assert.False(JToken.DeepEquals(r1, r3));
        }
        public void RawChildValues()
        {
            var o = new JObject();
            o["val1"] = new JRaw("1");
            o["val2"] = new JRaw("1");

            string json = o.ToString();

            StringAssert.Equal(@"{
  ""val1"": 1,
  ""val2"": 1
}", json);
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JRaw"/> class from another <see cref="JRaw"/> object.
 /// </summary>
 /// <param name="other">A <see cref="JRaw"/> object to copy from.</param>
 public JRaw(JRaw other)
     : base(other)
 {
 }