Ejemplo n.º 1
0
        public CompositeTokenMatchLocationTests()
        {
            this.match1 = new Mock <ITokenLocationMatch>();
            this.match1.SetupGet(t => t.MinTokenIndex).Returns(100);
            this.match1.SetupGet(t => t.MaxTokenIndex).Returns(200);
            this.match1Locations = new[] {
                new TokenLocation(100, 1, 2),
                new TokenLocation(200, 1, 2)
            };

            this.match1.Setup(m => m.GetLocations()).Returns(this.match1Locations);

            this.match2 = new Mock <ITokenLocationMatch>();
            this.match2.SetupGet(t => t.MinTokenIndex).Returns(110);
            this.match2.SetupGet(t => t.MaxTokenIndex).Returns(180);
            this.match2Locations = new[] {
                new TokenLocation(110, 1, 2),
                new TokenLocation(150, 1, 2),
                new TokenLocation(180, 1, 2)
            };

            this.match2.Setup(m => m.GetLocations()).Returns(this.match2Locations);

            this.sut1 = new CompositeTokenMatchLocation(this.match1.Object, this.match2.Object);
            this.sut2 = new CompositeTokenMatchLocation(this.match2.Object, this.match1.Object);
        }
Ejemplo n.º 2
0
        protected static CompositeTokenMatchLocation CompositeMatch(params int[] wordIndexes)
        {
            var match = CompositeMatch(wordIndexes[0], wordIndexes[1]);

            for (var i = 2; i < wordIndexes.Length; i++)
            {
                match = new CompositeTokenMatchLocation(match, TokenMatch(wordIndexes[i]));
            }

            return(match);
        }