public void Matches_CallsMatchesOnFirstDefinitionStep()
        {
            var definitionStep = new StepDefinitionMock(PathMatch.Succeed(0));
            var definition     = PathDefinition.Empty.Append(definitionStep);

            definition.Matches(Path.Empty);

            Assert.AreEqual(
                1,
                definitionStep.InvocationCount,
                "The PathDefinition did not call the first PathDefinitionStep."
                );
        }
        public void Matches_CallingMatchesNextOnPassedIteratorCallsNext()
        {
            var firstDefinitionStep  = new StepDefinitionMock(PathMatch.Succeed(0));
            var secondDefinitionStep = new StepDefinitionMock(PathMatch.Succeed(0));

            var definition = PathDefinition.Empty
                             .Append(firstDefinitionStep)
                             .Append(secondDefinitionStep);

            definition.Matches(Path.Empty);
            Assert.AreEqual(0, secondDefinitionStep.InvocationCount);

            firstDefinitionStep.DefinitionIterator.MatchesNext(Path.Empty.GetIterator());
            Assert.AreEqual(1, secondDefinitionStep.InvocationCount);
        }
        public void Matches_PassesPathIteratorAtFirstElementToFirstDefinitionStep()
        {
            var firstPathStep = new ViewModelStub();
            var path          = Path.Empty.Append(firstPathStep);

            var definitionStep = new StepDefinitionMock(PathMatch.Succeed(0));
            var definition     = PathDefinition.Empty.Append(definitionStep);

            definition.Matches(path);

            Assert.AreEqual(
                firstPathStep,
                definitionStep.PathIterator.ViewModel,
                "The PathIterator was not positioned at the first step."
                );
        }