public static void WhoIsWinner_BothPlayersHaveFour_FirstPlayerWithFourWins(params string[] testData)
        {
            var expected           = testData[0];
            var piecesPositionList = testData.Skip(1).ToList();

            Assert.Equal(expected, ConnectFour.WhoIsWinner(piecesPositionList));
        }
        public static void WhoIsWinner_CodewarsWinByDiagonal_ReturnsWinner(params string[] testData)
        {
            var expected           = testData[0];
            var piecesPositionList = testData.Skip(1).ToList();

            Assert.Equal(expected, ConnectFour.WhoIsWinner(piecesPositionList));
        }
Exemple #3
0
        public void RandomTest1()
        {
            var myList =
                "C_Yellow-A_Red-D_Yellow-C_Red-E_Yellow-G_Red-A_Yellow-F_Red-F_Yellow-E_Red-C_Yellow-B_Red-A_Yellow-D_Red-E_Yellow-C_Red-B_Yellow-A_Red-C_Yellow-B_Red-A_Yellow-D_Red-D_Yellow-D_Red-D_Yellow-C_Red-A_Yellow-G_Red-F_Yellow-B_Red-F_Yellow-F_Red-E_Yellow-B_Red-B_Yellow-G_Red-E_Yellow-E_Red-F_Yellow-G_Red-G_Yellow-G_Red"
                .Split('-').ToList();

            Assert.AreEqual("Red", ConnectFour.WhoIsWinner(myList), "it should return Red");
        }
Exemple #4
0
        public void FirstTest()
        {
            List <string> myList = new List <string>()
            {
                "A_Red",
                "B_Yellow",
                "A_Red",
                "B_Yellow",
                "A_Red",
                "B_Yellow",
                "G_Red",
                "B_Yellow"
            };

            Assert.AreEqual("Yellow", ConnectFour.WhoIsWinner(myList));
        }
Exemple #5
0
        public void ThirdTest()
        {
            List <string> myList = new List <string>()
            {
                "A_Yellow",
                "B_Red",
                "B_Yellow",
                "C_Red",
                "G_Yellow",
                "C_Red",
                "C_Yellow",
                "D_Red",
                "G_Yellow",
                "D_Red",
                "G_Yellow",
                "D_Red",
                "F_Yellow",
                "E_Red",
                "D_Yellow"
            };

            Assert.AreEqual("Red", ConnectFour.WhoIsWinner(myList));
        }
Exemple #6
0
    static void Main(string[] args)
    {
        List <string> myList = new List <string>()
        {
            "A_Yellow",
            "B_Red",
            "B_Yellow",
            "C_Red",
            "G_Yellow",
            "C_Red",
            "C_Yellow",
            "D_Red",
            "G_Yellow",
            "D_Red",
            "G_Yellow",
            "D_Red",
            "F_Yellow",
            "E_Red",
            "D_Yellow"
        };

        Console.WriteLine(ConnectFour.WhoIsWinner(myList));
    }
Exemple #7
0
        public void CanWhoIsWinner()
        {
            string winner = connectFour.WhoIsWinner(new List <string>());

            winner.Should().Be("Draw");
        }
Exemple #8
0
    public static void Main()
    {
        List <string> myList1 = new List <string>()
        {
            "A_Red",
            "B_Yellow",
            "A_Red",
            "B_Yellow",
            "A_Red",
            "B_Yellow",
            "G_Red",
            "B_Yellow"
        };

        Console.WriteLine(ConnectFour.WhoIsWinner(myList1));

        List <string> myList2 = new List <string>()
        {
            "C_Yellow",
            "E_Red",
            "G_Yellow",
            "B_Red",
            "D_Yellow",
            "B_Red",
            "B_Yellow",
            "G_Red",
            "C_Yellow",
            "C_Red",
            "D_Yellow",
            "F_Red",
            "E_Yellow",
            "A_Red",
            "A_Yellow",
            "G_Red",
            "A_Yellow",
            "F_Red",
            "F_Yellow",
            "D_Red",
            "B_Yellow",
            "E_Red",
            "D_Yellow",
            "A_Red",
            "G_Yellow",
            "D_Red",
            "D_Yellow",
            "C_Red"
        };

        Console.WriteLine(ConnectFour.WhoIsWinner(myList2));

        List <string> myList3 = new List <string>()
        {
            "A_Yellow",
            "B_Red",
            "B_Yellow",
            "C_Red",
            "G_Yellow",
            "C_Red",
            "C_Yellow",
            "D_Red",
            "G_Yellow",
            "D_Red",
            "G_Yellow",
            "D_Red",
            "F_Yellow",
            "E_Red",
            "D_Yellow"
        };

        Console.WriteLine(ConnectFour.WhoIsWinner(myList3));
    }
 public static void WhoIsWinner_NonWinningMoves_ReturnsDraw(params string[] piecesPositionList)
 {
     Assert.Equal("Draw", ConnectFour.WhoIsWinner(piecesPositionList.ToList()));
 }