示例#1
0
        public void Verify_That_WriteXml_Throws_Exception_When_Type_Is_Null()
        {
            using var memoryStream = new MemoryStream();
            using var writer       = XmlWriter.Create(memoryStream, new XmlWriterSettings { Indent = true });

            var attributeDefinitionString = new AttributeDefinitionString();

            Assert.That(() => attributeDefinitionString.WriteXml(writer), Throws.Exception.TypeOf <SerializationException>());
        }
示例#2
0
 public void VerifyThatWriteXmlThrowsExceptionWhenTypeIsNull()
 {
     using (var fs = new FileStream("test.xml", FileMode.Create))
     {
         using (var writer = XmlWriter.Create(fs, new XmlWriterSettings {
             Indent = true
         }))
         {
             var attributeDefinitionString = new AttributeDefinitionString();
             Assert.Throws <SerializationException>(() => attributeDefinitionString.WriteXml(writer));
         }
     }
 }