aboutsummaryrefslogtreecommitdiff
path: root/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs
blob: a7be0eef98de8297352de5bae2c04f9157e91f8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace MundusTests.ServiceTests.Tiles.Crafting 
{
    using System.Linq;
    using Mundus.Data;
    using Mundus.Service.Tiles;
    using Mundus.Service.Tiles.Items.Presets;
    using Mundus.Service.Tiles.Mobs;
    using NUnit.Framework;

    [TestFixture]
    public static class CraftingControllerTests 
    {
        [Test]
        public static void PlayerSuccessfullyCrafts() 
        {
            var recipe = DataBaseContexts.CTContext.CraftingRecipes.First(x => x.ResultItem == "wooden_shovel");

            for (int i = 0; i < recipe.Count1; i++) 
            {
                MI.Player.Inventory.AppendToItems(MaterialPresets.GetALandStick());
            }

            RecipeController.CraftItemPlayer(recipe);

            Assert.Contains(recipe.ResultItem, MI.Player.Inventory.Items.Where(x => x != null).Select(x => x.stock_id).ToArray(), "Result item isn't added to player's inventory");
            Assert.AreEqual(1, MI.Player.Inventory.Items.Where(x => x != null).Count(), "Not all required items are removed from player's inventory");
        }
    }
}