Exemple #1
0
        public void AddExistantDungeon_ThrowsException_Test()
        {
            // Arrange
            var quest             = QuestFactory.CreateStored(out var gameStore, out var gameId);
            var addDungeon        = DungeonMessage.CreateAdd(1, new[] { epicDungeon });
            var addAnotherDungeon = DungeonMessage.CreateAdd(2, new[] { epicDungeon });

            quest.AddMessage(gameId, addDungeon);

            // Act & Assert
            Assert.Throws <InvalidActionException>(() => quest.AddMessage(gameId, addAnotherDungeon));
        }
Exemple #2
0
        public void AddDungeon_ThenUndoIt_ResultsInNoChange_Test()
        {
            // Arrange
            var quest          = QuestFactory.CreateStored(out var gameStore, out var gameId);
            var dungeonMessage = DungeonMessage.CreateAdd(1, new[] { epicDungeon });

            // Act
            quest.AddMessage(gameId, dungeonMessage);
            var game = quest.Undo(gameId);

            // Assert
            Assert.Empty(game.Score.Dungeons);
        }
Exemple #3
0
        public void AddDungeon_ResultsInAddedDungeon_Test()
        {
            // Arrange
            var quest          = QuestFactory.CreateStored(out var gameStore, out var gameId);
            var dungeonMessage = DungeonMessage.CreateAdd(1, new[] { epicDungeon });

            // Act
            var game = quest.AddMessage(gameId, dungeonMessage);

            // Assert
            Assert.Single(game.Score.Dungeons);
            Assert.Equal(epicDungeon, game.Score.Dungeons.First());
        }
Exemple #4
0
        public void AddDungeon_ThenRemoveIt_ResultsInNoChange_Test()
        {
            // Arrange
            var quest         = QuestFactory.CreateStored(out var gameStore, out var gameId);
            var addDungeon    = DungeonMessage.CreateAdd(1, new[] { epicDungeon });
            var removeDungeon = DungeonMessage.CreateRemove(2, new[] { epicDungeon });

            // Act
            quest.AddMessage(gameId, addDungeon);
            var game = quest.AddMessage(gameId, removeDungeon);

            // Assert
            Assert.Empty(game.Score.Dungeons);
        }
Exemple #5
0
        public void AddDungeon_ThenSwitch_ResultsInSwitchedDungeon_Test()
        {
            // Arrange
            var quest         = QuestFactory.CreateStored(out var gameStore, out var gameId);
            var addDungeon    = DungeonMessage.CreateAdd(1, new[] { epicDungeon });
            var switchDungeon = DungeonMessage.Create(2, new[] { mightyDungeon }, new[] { epicDungeon });

            // Act
            quest.AddMessage(gameId, addDungeon);
            var game = quest.AddMessage(gameId, switchDungeon);

            // Assert
            Assert.Single(game.Score.Dungeons);
            Assert.Equal(mightyDungeon, game.Score.Dungeons.First());
        }
Exemple #6
0
        public void AddDungeon_ThenRemove_ThenUndoIt_ResultsInAddedDungeon_Test()
        {
            // Arrange
            var quest         = QuestFactory.CreateStored(out var gameStore, out var gameId);
            var addDungeon    = DungeonMessage.CreateAdd(1, new[] { epicDungeon });
            var removeDungeon = DungeonMessage.CreateRemove(2, new[] { epicDungeon });

            // Act
            quest.AddMessage(gameId, addDungeon);
            quest.AddMessage(gameId, removeDungeon);
            var game = quest.Undo(gameId);

            // Assert
            Assert.Single(game.Score.Dungeons);
            Assert.Equal(epicDungeon, game.Score.Dungeons.First());
        }