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 } }
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 } }