public void Verify_That_WriteXml_Without_Definition_Set_Throws_SerializationException() { using var memoryStream = new MemoryStream(); using var writer = XmlWriter.Create(memoryStream, new XmlWriterSettings { Indent = true }); var attributeValueReal = new AttributeValueBoolean(); Assert.That( () => attributeValueReal.WriteXml(writer), Throws.Exception.TypeOf <SerializationException>() .With.Message.Contains("The Definition property of an AttributeValueBoolean may not be null")); }
public void VerifyThatWriteXmlWithoutDefinitionSetThrowsSerializationException() { using (var fs = new FileStream("test.xml", FileMode.Create)) { using (var writer = XmlWriter.Create(fs, new XmlWriterSettings { Indent = true })) { var attributeValueReal = new AttributeValueBoolean(); Assert.Throws <SerializationException>(() => attributeValueReal.WriteXml(writer)); } } }