Ejemplo n.º 1
0
 public void LaxValidationFails()
 {
     using (var xmlReader = GetXmlReader(INVALID_LAX_ARGUMENTS_XML))
     {
         var arguments = new XlangMessage <Calculator.LaxArguments>(XmlSchemaContentProcessing.Lax);
         // ReSharper disable AccessToDisposedClosure
         Assert.That(() => arguments.ReadXml(xmlReader), Throws.TypeOf <XmlSchemaValidationException>());
         // ReSharper restore AccessToDisposedClosure
     }
 }
Ejemplo n.º 2
0
 public void StrictValidationSucceeds()
 {
     using (var xmlReader = GetXmlReader(LAX_ARGUMENTS_XML))
     {
         var arguments = new XlangMessage <Calculator.LaxArguments>(XmlSchemaContentProcessing.Strict);
         // ReSharper disable AccessToDisposedClosure
         Assert.That(() => arguments.ReadXml(xmlReader), Throws.Nothing);
         // ReSharper restore AccessToDisposedClosure
     }
     using (var xmlReader = GetXmlReader(CALCULATOR_REQUEST_XML))
     {
         var arguments = new XlangMessage <Calculator.LaxArguments>(XmlSchemaContentProcessing.Strict);
         // ReSharper disable AccessToDisposedClosure
         Assert.That(() => arguments.ReadXml(xmlReader), Throws.Nothing);
         // ReSharper restore AccessToDisposedClosure
     }
 }