diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2020-05-22 12:59:32 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2020-05-22 12:59:32 +0300 |
| commit | 747aa00440eb9b219d989a536b0ff0c959b35143 (patch) | |
| tree | f8b866f8e95c4597cae6b246746c23967e03def6 /MundusTests/ServiceTests/Tiles/Items | |
| parent | a4e2f6753c6c2612444847fd12f1e973a86a4aa4 (diff) | |
| download | Mundus-747aa00440eb9b219d989a536b0ff0c959b35143.tar Mundus-747aa00440eb9b219d989a536b0ff0c959b35143.tar.gz Mundus-747aa00440eb9b219d989a536b0ff0c959b35143.zip | |
Completed all tests (there is still some code that can be tested, but it will be very hard to do so and I am skipping it for now).
Diffstat (limited to 'MundusTests/ServiceTests/Tiles/Items')
| -rw-r--r-- | MundusTests/ServiceTests/Tiles/Items/ItemControllerTests.cs | 36 | ||||
| -rw-r--r-- | MundusTests/ServiceTests/Tiles/Items/Types/StructureTests.cs | 4 |
2 files changed, 22 insertions, 18 deletions
diff --git a/MundusTests/ServiceTests/Tiles/Items/ItemControllerTests.cs b/MundusTests/ServiceTests/Tiles/Items/ItemControllerTests.cs index 497ccf3..a399e04 100644 --- a/MundusTests/ServiceTests/Tiles/Items/ItemControllerTests.cs +++ b/MundusTests/ServiceTests/Tiles/Items/ItemControllerTests.cs @@ -1,19 +1,18 @@ -using System; -using Mundus.Data; -using NUnit.Framework; -using Gtk; -using Mundus.Data.Windows; -using static Mundus.Service.Tiles.Mobs.Inventory; -using Mundus.Service.Tiles.Items; -using Mundus.Service.Tiles.Mobs; +namespace MundusTests.ServiceTests.Tiles.Items +{ + using Mundus.Service.Tiles.Items; + using Mundus.Service.Tiles.Mobs; + using NUnit.Framework; + using static Mundus.Service.Tiles.Mobs.Inventory; -namespace MundusTests.ServiceTests.Tiles.Items { [TestFixture] - public static class ItemControllerTests { + public static class ItemControllerTests + { [Test] [TestCase(InventoryPlace.Accessories, 1)] [TestCase(InventoryPlace.Hotbar, 4)] - public static void SelectsItemProperly(InventoryPlace place, int index) { + public static void SelectsItemProperly(InventoryPlace place, int index) + { ItemController.SelectItem(place, index); Assert.AreEqual(place, ItemController.SelItemPlace, "Item place isn't set correctly"); @@ -22,7 +21,8 @@ namespace MundusTests.ServiceTests.Tiles.Items { [Test] [TestCase(InventoryPlace.Hotbar, 1, InventoryPlace.Items, 1)] - public static void SwitchesDifferentItemsProperly(InventoryPlace origin, int originIndex, InventoryPlace destination, int destinationIndex) { + public static void SwitchesDifferentItemsProperly(InventoryPlace origin, int originIndex, InventoryPlace destination, int destinationIndex) + { ItemController.SelectItem(destination, destinationIndex); var destinationItem = Inventory.GetPlayerItemFromItemSelection(); @@ -32,18 +32,22 @@ namespace MundusTests.ServiceTests.Tiles.Items { ItemController.SwitchItems(destination, destinationIndex); ItemController.SelectItem(origin, originIndex); - if (Inventory.GetPlayerItemFromItemSelection() != null) { + if (Inventory.GetPlayerItemFromItemSelection() != null) + { Assert.AreEqual(destinationItem.stock_id, Inventory.GetPlayerItemFromItemSelection().stock_id); } - else { + else + { Assert.Pass(); } ItemController.SelectItem(destination, destinationIndex); - if (Inventory.GetPlayerItemFromItemSelection() != null) { + if (Inventory.GetPlayerItemFromItemSelection() != null) + { Assert.AreEqual(originItem.stock_id, Inventory.GetPlayerItemFromItemSelection()); } - else { + else + { Assert.Pass(); } } diff --git a/MundusTests/ServiceTests/Tiles/Items/Types/StructureTests.cs b/MundusTests/ServiceTests/Tiles/Items/Types/StructureTests.cs index 0a18a1b..dd9b80b 100644 --- a/MundusTests/ServiceTests/Tiles/Items/Types/StructureTests.cs +++ b/MundusTests/ServiceTests/Tiles/Items/Types/StructureTests.cs @@ -12,7 +12,7 @@ [TestCase("test")] public static void InstantiatesFromStock(string stock_id) { - Structure gt = new Structure(stock_id, "", 0, ToolType.Axe, 0); + Structure gt = new Structure(stock_id, string.Empty, 0, ToolType.Axe, 0); Assert.AreEqual(stock_id, gt.stock_id, "Structure doesn't set stock_id properly"); } @@ -20,7 +20,7 @@ [Test] public static void InstantiatesFromAnotherStructure() { - Structure gt = new Structure("testing", "", 0, ToolType.Axe, 0); + Structure gt = new Structure("testing", string.Empty, 0, ToolType.Axe, 0); Structure gt1 = new Structure(gt); Assert.AreEqual(gt.stock_id, gt1.stock_id, "Structure constructor doesn't work properly with a groundtile as a parameter"); |
