public void DerivedProcessorMustInitializeBase()
		{
			string xml = "<root>foo</root>";
			XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml));

			reader.Processors.Add(new MockProcessorDerived());

			while (reader.Read()) { }
		}
Пример #2
0
        public void DerivedProcessorCannotInitializeNullPredicate()
        {
            string             xml    = "<root>foo</root>";
            XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml));

            reader.Processors.Add(new MockProcessorDerivedNullPredicate());

            while (reader.Read())
            {
            }
        }
Пример #3
0
        public void DerivedProcessorMustInitializeBase()
        {
            string             xml    = "<root>foo</root>";
            XmlProcessorReader reader = new XmlProcessorReader(GetReader(xml));

            reader.Processors.Add(new MockProcessorDerived());

            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);
		}
Пример #5
0
        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);
		}
Пример #7
0
        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()) { }
		}