Esempio n. 1
0
        public async Task CanAddItemToLoot()
        {
            var repo = BuildRepo();

            await repo.AddItemToLoot(1, 3);

            EnemyDTO enemy = await repo.GetEnemy(1);

            EnemyLootDTO expected = new EnemyLootDTO()
            {
                EnemyId = 1,
                ItemId  = 3,
                Item    = new ItemDTO
                {
                    Id    = 3,
                    Name  = "Dungeon Key",
                    Value = "100 cp"
                }
            };
            bool found = false;

            foreach (var item in enemy.Loot)
            {
                if (item.ItemId == expected.ItemId)
                {
                    Assert.Equal(expected.EnemyId, item.EnemyId);
                    Assert.Equal(expected.Item.Name, item.Item.Name);
                    found = true;
                }
            }
            Assert.True(found);
        }
Esempio n. 2
0
        public async Task CanRemoveItemFromLoot()
        {
            var repo = BuildRepo();

            await repo.RemoveItemFromLoot(1, 2);

            EnemyDTO enemy = await repo.GetEnemy(1);

            EnemyLootDTO expected = new EnemyLootDTO()
            {
                EnemyId = 1,
                ItemId  = 2,
                Item    = new ItemDTO
                {
                    Id    = 2,
                    Name  = "Cup",
                    Value = "100 cp"
                }
            };

            Assert.DoesNotContain(expected, enemy.Loot);
        }