public void GetResolution_only_one_living_player_ends_match() { var stockRule = new TimeStockMatchRule(); Assert.AreEqual(MatchResolution.HasWinner, stockRule.GetResolution(CreateGameState(100, new[] { 1, 0, 0, 0 }))); Assert.AreEqual(MatchResolution.HasWinner, stockRule.GetResolution(CreateGameState(100, new[] { 0, 5, 0, 0 }))); Assert.AreEqual(MatchResolution.HasWinner, stockRule.GetResolution(CreateGameState(100, new[] { 0, 0, 2, 0 }))); Assert.AreEqual(MatchResolution.HasWinner, stockRule.GetResolution(CreateGameState(100, new[] { 0, 0, 0, 3 }))); }
public void GetResolution_zero_time_results_in_timeout() { var timeMatchRule = new TimeStockMatchRule(); var config = new MatchConfig { Stocks = 5, PlayerConfigs = new PlayerConfig[4] }; var state = new MatchState(config) { Time = 0 }; Assert.AreEqual(MatchResolution.Tie, timeMatchRule.GetResolution(state)); }
public void GetResolution_continues_game_with_remaining_time() { var timeMatchRule = new TimeStockMatchRule(); var config = new MatchConfig { Stocks = 5, PlayerConfigs = new PlayerConfig[4] }; var state = new MatchState(config) { Time = 100 }; Assert.AreEqual(null, timeMatchRule.GetResolution(state)); }
public void GetResolution_non_zero_stocks_does_not_end_match() { var stockRule = new TimeStockMatchRule(); Assert.AreEqual(null, stockRule.GetResolution(CreateGameState(100, new[] { 1, 2, 3, 4 }))); }