コード例 #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 attributeDefinitionReal = new AttributeDefinitionReal();

            Assert.That(() => attributeDefinitionReal.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 attributeDefinitionReal = new AttributeDefinitionReal();
             Assert.Throws <SerializationException>(() => attributeDefinitionReal.WriteXml(writer));
         }
     }
 }