public void RefreshCategorizedVisibility() { lock (GameCategories) { try { // Get the master category var master = GameCategories.First(x => x.IsMaster); // Set the master category visibility master.IsVisible = false; // Set the categories visibility GameCategories.Where(x => !x.IsMaster).ForEach(x => x.IsVisible = Data.UI_CategorizeGames); // Set the selected index SelectedCategoryIndex = Data.UI_CategorizeGames ? GameCategories.FindItemIndex(x => !x.IsMaster) : GameCategories.FindItemIndex(x => x == master); } catch (Exception ex) { Logger.Error(ex, "Refreshing game category visibility"); throw; } } }
public void MoveCurrentPlayer() { const string playerId = "p1Id"; var game = GetGame( new GameStarted("gameId", "name", GameCategories), new PlayerAdded(playerId, "player1"), new CurrentPlayerChanged(playerId), new PlayerAdded("p2Id", "player2")); var fakeDice = new FakeDice(2); var events = game.Move(fakeDice, playerId); var question = GameCategories.First().Questions.First().Question; Check.That(events).ContainsExactly( new Moved(playerId, 2), new QuestionAsked(question.Id, question.Text, question.Answer)); }
public void MoveCurrentPlayerIfInPenaltyBoxButRollOddDice() { const string player1Id = "p1Id"; const string player2Id = "p2Id"; var game = GetGame( new GameStarted("gameId", "name", GameCategories), new PlayerAdded(player1Id, "player1"), new CurrentPlayerChanged(player1Id), new PlayerAdded(player2Id, "player2"), new Moved(player1Id, 2), new QuestionAsked(1, "question", "answer"), new GoneToPenaltyBox(player1Id) /* Bypass Player2 turn */); var fakeDice = new FakeDice(3); var events = game.Move(fakeDice, player1Id); var question = GameCategories.First().Questions.First().Question; Check.That(events).ContainsExactly( new GetOutOfPenaltyBox(player1Id), new Moved(player1Id, 5), new QuestionAsked(question.Id, question.Text, question.Answer)); }