I wouldn't think it would make that big of a difference, but the below
behavior seems strange to me, looking at the tests, both are used.

The first test fails and the second passes. Ayende, can you explain
the reasoning behind this behavior and if you think it is a bug or is
expected? I would expect both to behave the same.

        [Test]
        public void MultipleIterationsDoesntAffectOtherOperations2()
        {
            BaseProcess process =
MockRepository.GenerateStub<BaseProcess>();
            GenerateOperation genOp = new GenerateOperation(process);
            process.Register(genOp);
            process.Register(new IterateOperation(process));
            process.Execute();

            Assert.AreEqual(1, genOp.TimesExecuted);
        }

        [Test]
        public void MultipleIterationsDoesntAffectOtherOperations3()
        {
            BaseProcess process =
MockRepository.GenerateStub<BaseProcess>();
            GenerateOperation genOp = new GenerateOperation(process);
            process.RegisterLast(genOp);
            process.RegisterLast(new IterateOperation(process));
            process.Execute();

            Assert.AreEqual(1, genOp.TimesExecuted);
        }

        public class GenerateOperation : BaseOperation
        {
            public int TimesExecuted = 0;

            public GenerateOperation(BaseProcess process) : base
(process)
            {

            }

            public override IEnumerable<Row> Execute(IEnumerable<Row>
rows)
            {
                TimesExecuted++;

                Console.WriteLine("row");
                yield return Row.FromObject(new { Property1 = "1" });

                Console.WriteLine("row");
                yield return Row.FromObject(new { Property1 = "1" });
            }
        }

        public class IterateOperation : BaseOperation
        {
            public IterateOperation(BaseProcess process) : base
(process)
            {

            }

            public override IEnumerable<Row> Execute(IEnumerable<Row>
rows)
            {
                foreach (Row row in rows) ;

                foreach (Row row in rows) ;

                yield return new Row();
            }
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to