示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }