Example #1
0
        public void IsInListWithEmptyListTest()
        {
            Location[] targetLocs = new Location[0];

            Location testLoc = new Location(1, 1);

            Assert.IsFalse(testLoc.IsInList(targetLocs));
            Assert.AreEqual(-1, testLoc.ListIndex(targetLocs));
        }
Example #2
0
        public void IsInListWithTowItems()
        {
            Location[] targetLocs = new[]
                {
                    new Location(1, 1),
                    new Location(2, 1)
                };

            Location testLoc11 = new Location(1, 1);
            Location testLoc21 = new Location(2, 1);
            Location testLoc22 = new Location(2, 2);

            Assert.IsTrue(testLoc11.IsInList(targetLocs));
            Assert.AreEqual(0, testLoc11.ListIndex(targetLocs));

            Assert.IsTrue(testLoc21.IsInList(targetLocs));
            Assert.AreEqual(1, testLoc21.ListIndex(targetLocs));

            Assert.IsFalse(testLoc22.IsInList(targetLocs));
            Assert.AreEqual(-1, testLoc22.ListIndex(targetLocs));
        }