public void DerivedProcessorMustInitializeBase() { string xml = "<root>foo</root>"; XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml)); reader.Processors.Add(new MockProcessorDerived()); while (reader.Read()) { } }
public void DerivedProcessorCannotInitializeNullPredicate() { string xml = "<root>foo</root>"; XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml)); reader.Processors.Add(new MockProcessorDerivedNullPredicate()); while (reader.Read()) { } }
public void ActionCalledIfPredicateTrue() { string xml = "<root>foo</root>"; XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml)); int actionCalls = 0; reader.Processors.Add(new PredicateActionXmlProcessor( delegate(XmlReader predicateReader) { return predicateReader.NodeType == XmlNodeType.Text; }, delegate { actionCalls++; } ) ); while (reader.Read()) { } Assert.AreEqual(1, actionCalls); }
public void ActionCalledIfPredicateTrue() { string xml = "<root>foo</root>"; XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml)); int actionCalls = 0; reader.Processors.Add(new PredicateActionXmlProcessor( delegate(XmlReader predicateReader) { return(predicateReader.NodeType == XmlNodeType.Text); }, delegate { actionCalls++; } ) ); while (reader.Read()) { } Assert.AreEqual(1, actionCalls); }
public void PredicateTrueAndActionCalledForEachRead() { string xml = "<root>foo</root>"; XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml)); int predicateCalls = 0; int actionCalls = 0; reader.Processors.Add(new PredicateActionXmlProcessor( delegate { predicateCalls++; return true; }, delegate { actionCalls++; } ) ); while (reader.Read()) { } Assert.AreEqual(3, predicateCalls); Assert.AreEqual(3, actionCalls); }
public void PredicateTrueAndActionCalledForEachRead() { string xml = "<root>foo</root>"; XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml)); int predicateCalls = 0; int actionCalls = 0; reader.Processors.Add(new PredicateActionXmlProcessor( delegate { predicateCalls++; return(true); }, delegate { actionCalls++; } ) ); while (reader.Read()) { } Assert.AreEqual(3, predicateCalls); Assert.AreEqual(3, actionCalls); }
public void DerivedProcessorCannotInitializeNullAction() { string xml = "<root>foo</root>"; XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml)); reader.Processors.Add(new MockProcessorDerivedNullAction()); while (reader.Read()) { } }