コード例 #1
0
        public void AssertThat_BaseRef_SelectsFirstSections_WhenFilterFirstIsSpecified()
        {
            IdRef bot = new IdRef("skylobby", SearchDirection.Up, RefFilter.All, false, false);
            IdRef top = new IdRef("skylobby", SearchDirection.Up, RefFilter.First, false, false);

            var b       = bot.Match(_floors, null).ToArray();
            var matched = top.MatchFrom(_floors, bot, b).ToArray();

            Assert.AreEqual(2, matched.Count());
            Assert.IsTrue(matched.Any(a => a.Key.Index == 4 && a.Value.Index == 8));
            Assert.IsTrue(matched.Any(a => a.Key.Index == 8 && a.Value.Index == 12));
        }
コード例 #2
0
        public void AssertThat_BaseRef_MatchFrom_SelectsNonOverlappingSections_WhenNonOverlappingModeIsSpecified()
        {
            IdRef residential = new IdRef("residential", SearchDirection.Up, RefFilter.All, false, false);
            IdRef skylobby    = new IdRef("skylobby", SearchDirection.Up, RefFilter.First, true, false);

            var res     = residential.Match(_floors, null).ToArray();
            var matched = skylobby.MatchFrom(_floors, residential, res).ToArray();

            //We should have matched all the residential floors, paired with the next skylobby up
            //Then filtered these floors into groups which overlap, and take the first (i.e. lowest floor to next skylobby)
            Assert.AreEqual(3, matched.Count());
            Assert.IsTrue(matched.Any(a => a.Key.Index == 1 && a.Value.Index == 4));
            Assert.IsTrue(matched.Any(a => a.Key.Index == 5 && a.Value.Index == 8));
            Assert.IsTrue(matched.Any(a => a.Key.Index == 9 && a.Value.Index == 12));
        }