Exemple #1
0
        public void RemoveRaceFromUnknownHero_ThrowsException_Test()
        {
            // Arrange
            var removeRaceMessage = RaceMessage.CreateRemove(_sequence.Next, Guid.NewGuid(), new[] { _humanRace });

            // Act & Assert
            Assert.Throws<InvalidActionException>(() => _quest.AddMessage(_gameId, removeRaceMessage));
        }
Exemple #2
0
        public void RemoveNotExistingRaceFromHero_ThrowsException_Test()
        {
            // Arrange
            var removeRaceMessage = RaceMessage.CreateRemove(_sequence.Next, _playerId, new[] { _humanRace });

            // Act & Assert
            Assert.Throws<InvalidActionException>(() => _quest.AddMessage(_gameId, removeRaceMessage));
        }
Exemple #3
0
        public void AddRaceToHero_ThenRemoveIt_ResultsInNoChange_Test()
        {
            // Arrange
            var addRaceMessage = RaceMessage.CreateAdd(_sequence.Next, _playerId, new[] { _humanRace });
            var removeRaceMessage = RaceMessage.CreateRemove(_sequence.Next, _playerId, new[] { _humanRace });

            // Act
            _quest.AddMessage(_gameId, addRaceMessage);
            var game = _quest.AddMessage(_gameId, removeRaceMessage);

            // Assert
            Assert.Empty(game.Score.Heroes.First(x => x.Player.Id == _playerId).Races);
        }
Exemple #4
0
        public void AddRaceToHero_ThenRemoveIt_ThenUndoIt_ResultsInAddedRace_Test()
        {
            // Arrange
            var addRaceMessage = RaceMessage.CreateAdd(_sequence.Next, _playerId, new[] { _humanRace });
            var removeRaceMessage = RaceMessage.CreateRemove(_sequence.Next, _playerId, new[] { _humanRace });

            // Act
            _quest.AddMessage(_gameId, addRaceMessage);
            _quest.AddMessage(_gameId, removeRaceMessage);
            var game = _quest.Undo(_gameId);

            // Assert
            Assert.Single(game.Score.Heroes.First(x => x.Player.Id == _playerId).Races);
            Assert.Contains(_humanRace, game.Score.Heroes.First(x => x.Player.Id == _playerId).Races);
        }