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); }
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); }
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); }
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); }