public void RemoveNotExistingClassFromHero_ThrowsException_Test() { // Arrange var removeClassMessage = ClassMessage.CreateRemove(_sequence.Next, _playerId, new[] { _warriorClass }); // Act & Assert Assert.Throws<InvalidActionException>(() => _quest.AddMessage(_gameId, removeClassMessage)); }
public void RemoveClassFromUnknownHero_ThrowsException_Test() { // Arrange var removeClassMessage = ClassMessage.CreateRemove(_sequence.Next, Guid.NewGuid(), new[] { _warriorClass }); // Act & Assert Assert.Throws<InvalidActionException>(() => _quest.AddMessage(_gameId, removeClassMessage)); }
public void AddClassToHero_ThenRemoveIt_ResultsInNoChange_Test() { // Arrange var addClassMessage = ClassMessage.CreateAdd(_sequence.Next, _playerId, new[] { _warriorClass }); var removeClassMessage = ClassMessage.CreateRemove(_sequence.Next, _playerId, new[] { _warriorClass }); // Act _quest.AddMessage(_gameId, addClassMessage); var game = _quest.AddMessage(_gameId, removeClassMessage); // Assert Assert.Empty(game.Score.Heroes.First(x => x.Player.Id == _playerId).Classes); }
public void AddClassToHero_ThenRemoveIt_ThenUndoIt_ResultsInAddedClass_Test() { // Arrange var addClassMessage = ClassMessage.CreateAdd(_sequence.Next, _playerId, new[] { _warriorClass }); var removeClassMessage = ClassMessage.CreateRemove(_sequence.Next, _playerId, new[] { _warriorClass }); // Act _quest.AddMessage(_gameId, addClassMessage); _quest.AddMessage(_gameId, removeClassMessage); var game = _quest.Undo(_gameId); // Assert Assert.Single(game.Score.Heroes.First(x => x.Player.Id == _playerId).Classes); Assert.Contains(_warriorClass, game.Score.Heroes.First(x => x.Player.Id == _playerId).Classes); }