Exemple #1
0
        public void TestErrorsForNull()
        {
            ServiceClientCredentials serviceClientCredentials = new TokenCredentials("FakeTokenValue");
            TicTacToeSDKClient       client = new TicTacToeSDKClient(new Uri("https://localhost:44305"), serviceClientCredentials);

            Object update = client.ExecuteMove(new Board(null));

            Assert.IsTrue(update is ErrorResponse);
        }
Exemple #2
0
        public void TestErrorsForNonSymbol()
        {
            List <string> list = new List <string> {
                "A", // nope
                "?",
                "?",
                "?",
                "?",
                "?",
                "?",
                "?",
                "?"
            };
            ServiceClientCredentials serviceClientCredentials = new TokenCredentials("FakeTokenValue");
            TicTacToeSDKClient       client = new TicTacToeSDKClient(new Uri("https://localhost:44305"), serviceClientCredentials);

            Object update = client.ExecuteMove(new Board(list));

            Assert.IsTrue(update is ErrorResponse);
        }
Exemple #3
0
        public void TestDetectsXWin()
        {
            List <string> list = new List <string> {
                "X",
                "O",
                "?",
                "?",
                "X",
                "?",
                "?",
                "O",
                "X"
            };
            ServiceClientCredentials serviceClientCredentials = new TokenCredentials("FakeTokenValue");
            TicTacToeSDKClient       client = new TicTacToeSDKClient(new Uri("https://localhost:44305"), serviceClientCredentials);

            GameStateUpdate update = (GameStateUpdate)client.ExecuteMove(new Board(list));

            Assert.AreEqual <string> (update.Winner, "X");
            Assert.IsNotNull(update.WinPositions);
        }
Exemple #4
0
        public void TestPlaysXFirst()
        {
            List <string> list = new List <string> {
                "?",
                "?",
                "?",
                "?",
                "?",
                "?",
                "?",
                "?",
                "?"
            };
            ServiceClientCredentials serviceClientCredentials = new TokenCredentials("FakeTokenValue");
            TicTacToeSDKClient       client = new TicTacToeSDKClient(new Uri("https://localhost:44305"), serviceClientCredentials);

            GameStateUpdate update = (GameStateUpdate)client.ExecuteMove(new Board(list));

            Assert.AreEqual <string> (update.AzurePlayerSymbol, "X");
            Assert.AreEqual <string> (update.Winner, "inconclusive");
            Assert.IsNull(update.WinPositions);
        }