public void SerializeNull() { string dson = DsonConvert.SerializeObject(new { nullValue = (string)null }, Formatting.Indented); Assert.AreEqual(@"such ""nullValue"" is empty wow", dson); }
public void SerializeDate() { string dson = DsonConvert.SerializeObject(new { dateValue = new DateTime(2013, 11, 30) }, Formatting.Indented); Assert.AreEqual(@"such ""dateValue"" is ""2013-11-30T00:00:00"" wow", dson); }
public void SerializeObject() { string dson = DsonConvert.SerializeObject(new { hello = "world" }, Formatting.Indented); Assert.AreEqual(@"such ""hello"" is ""world"" wow", dson); }
public void SerializeBool() { string dson = DsonConvert.SerializeObject(new { trueValue = true, falseValue = false }, Formatting.Indented); Assert.AreEqual(@"such ""trueValue"" is yes, ""falseValue"" is no wow", dson); }
public void SerializeFloat() { string dson = DsonConvert.SerializeObject(new { doubleValue = 99e19d, singleValue = 99e-19f }, Formatting.Indented); Assert.AreEqual(@"such ""doubleValue"" is 9.9very+20, ""singleValue"" is 9.9very-18 wow", dson); }
public void SerializeArrayWithFormatting() { string dson = DsonConvert.SerializeObject(new { hello = "world", people = new[] { "James", "Brendon", "Amy" } }, Formatting.Indented); Assert.AreEqual(@"such ""hello"" is ""world"", ""people"" is so ""James"" and ""Brendon"" and ""Amy"" many wow", dson); }
public void SerializeByteArray() { string dson = DsonConvert.SerializeObject(new { hello = "world", people = Encoding.UTF8.GetBytes("how now brown cow") }); Assert.AreEqual(@"such ""hello"" is ""world"", ""people"" is ""aG93IG5vdyBicm93biBjb3c="" wow", dson); }