public void LoadInvalidDocument() { bool hasError = false; var doc = XmlLoader.LoadResourceAsString("InvalidDocument1"); Schema.XmlPdfDocument document = null; ((Action)(() => document = PDFFlowLib.Xml.Loader.LoadXmlPdfDocument(doc, (_ /*target*/, _ /*servery*/, _ /*message*/, _ /*exception*/) => hasError = true))).Should().NotThrow(); hasError.Should().BeTrue(); }
public void LoadGoodDocument() { bool hasError = false; string receivedMessage = null; var doc = XmlLoader.LoadResourceAsString("MinimumValidDocument"); Schema.XmlPdfDocument document = null; ((Action)(() => document = PDFFlowLib.Xml.Loader.LoadXmlPdfDocument(doc, (_ /*target*/, _ /*severity*/, message, _ /*exception*/) => { hasError = true; receivedMessage = message; }))).Should().NotThrow(); hasError.Should().BeFalse($"Document excepted to be valid, but \"{receivedMessage}\" was fired."); }