aboutsummaryrefslogtreecommitdiff
path: root/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2020-05-19 20:06:43 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2020-05-19 20:06:43 +0300
commit09d14d1f330d71bc69a4e9fedace680f9c69de3b (patch)
treed5622e10ef801992945cb5b9d9ea8a9509f465d8 /MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs
parent43e65fb3c92df024ee4eaff454b1fe340c07c41f (diff)
downloadMundus-09d14d1f330d71bc69a4e9fedace680f9c69de3b.tar
Mundus-09d14d1f330d71bc69a4e9fedace680f9c69de3b.tar.gz
Mundus-09d14d1f330d71bc69a4e9fedace680f9c69de3b.zip
Did all tests for Service/Tiles/Items and Service/Tiles/Items
Diffstat (limited to 'MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs')
-rw-r--r--MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs b/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs
new file mode 100644
index 0000000..1594f03
--- /dev/null
+++ b/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs
@@ -0,0 +1,45 @@
+namespace MundusTests.ServiceTests.Tiles.Crafting
+{
+ using System.Linq;
+ using Gtk;
+ using Mundus.Data;
+ using Mundus.Data.Tiles.Mobs;
+ using Mundus.Data.Tiles.Presets;
+ using Mundus.Data.Windows;
+ using Mundus.Service.Tiles.Crafting;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public static class CraftingControllerTests
+ {
+ [OneTimeSetUp]
+ public static void SetUp()
+ {
+ Application.Init();
+ DataBaseContexts.CreateInstances();
+ WI.CreateInstances();
+ WI.WNewGame.OnBtnGenerateClicked(null, null);
+ }
+
+ [OneTimeTearDown]
+ public static void TearDown()
+ {
+ Application.Quit();
+ }
+
+ [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());
+ }
+ CraftingController.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");
+ }
+ }
+}