示例#1
0
        public void ReturnCorrectResult_OnSimpleDungeon()
        {
            var textMap = new[]
            {
                "P #",
                "# #",
                "  P"
            };
            var expectedOwnersMap = new[]
            {
                "00#",
                "#0#",
                "111"
            };
            var expectedDistancesMap = new[]
            {
                "01#",
                "#2#",
                "210"
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = My_RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
示例#2
0
        public void ReturnCorrectResult_OnEmptyDungeon_WithMultiplePlayers()
        {
            var textMap = new[]
            {
                "P P",
                "   ",
                "P P"
            };
            var expectedOwnersMap = new[]
            {
                "001",
                "001",
                "223"
            };
            var expectedDistancesMap = new[]
            {
                "010",
                "121",
                "010"
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = My_RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
示例#3
0
        public void ReturnReuslt_WithCorrectOrder()
        {
            var textMap = new[]
            {
                "   ",
                " P ",
                "  P"
            };
            var expectedOwnersMap = new[]
            {
                "000",
                "000",
                "001"
            };
            var expectedDistancesMap = new[]
            {
                "212",
                "101",
                "210"
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = My_RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
示例#4
0
        public void ReturnCorrectResult_WhenSomeCellsAreUnreachable()
        {
            var textMap = new[]
            {
                "P ",
                "##",
                "  "
            };
            var expectedOwnersMap = new[]
            {
                "00",
                "##",
                "  "
            };
            var expectedDistancesMap = new[]
            {
                "01",
                "##",
                "  "
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = My_RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
示例#5
0
        public void ReturnCorrectResult_WhenNoPaths()
        {
            var textMap = new[]
            {
                "P#",
                "##",
                "#P"
            };
            var expectedOwnersMap = new[]
            {
                "0#",
                "##",
                "#1"
            };
            var expectedDistancesMap = new[]
            {
                "0#",
                "##",
                "#0"
            };
            var expected = ParseMaps(expectedOwnersMap, expectedDistancesMap);

            var actual = My_RivalsTask.AssignOwners(Map.FromLines(textMap));

            AssertResult(expected, actual);
        }
 private void PlayLevels(Map[] maps)
 {
     mapStates = new Dictionary <Map, List <OwnedLocation> >();
     foreach (var map in maps)
     {
         mapStates[map] = My_RivalsTask.AssignOwners(map).ToList();
     }
 }