public void XmlSerialization_NullNonNullableString_Throws() { var xmlString = new StringBuilder(); var xmlWriter = new SimpleXmlWriter(XmlWriter.Create(xmlString)); var nullString = new BasicTypes { _str = null }; Assert.Throws <NullReferenceException>(() => Serialize.To(xmlWriter, nullString)); var nullWString = new BasicTypes { _wstr = null }; Assert.Throws <NullReferenceException>(() => Serialize.To(xmlWriter, nullWString)); }
public void JsonSerialization_NullNonNullableString_Throws() { var ser = new Serializer <SimpleJsonWriter>(typeof(BasicTypes)); var stream = new StringWriter(); var jw = new SimpleJsonWriter(stream); var nullString = new BasicTypes { _str = null }; Assert.Throws <NullReferenceException>(() => ser.Serialize(nullString, jw)); var nullWString = new BasicTypes { _wstr = null }; Assert.Throws <NullReferenceException>(() => ser.Serialize(nullWString, jw)); }
public static bool IsEqual(this BasicTypes b, BasicTypesView v) { return(v._bool == b._bool && v._float == b._float && v._int8 == b._int8); }