From 5e5957a9047a5cc4aaf85efd38df9395fb03004b Mon Sep 17 00:00:00 2001 From: Devin Braune Date: Fri, 5 Feb 2021 14:51:32 +0100 Subject: [PATCH] Update selection unit test --- Assets/Scripts/Shop/Tests/ShopUnitTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Shop/Tests/ShopUnitTests.cs b/Assets/Scripts/Shop/Tests/ShopUnitTests.cs index 65432a9..29404c6 100644 --- a/Assets/Scripts/Shop/Tests/ShopUnitTests.cs +++ b/Assets/Scripts/Shop/Tests/ShopUnitTests.cs @@ -89,14 +89,14 @@ namespace Tests yield return null; Item item = shopView.ShopModel.GetSelectedItem(); + var highlight = shopView.transform.Find("Highlight"); // Conveniently this will only return an active object named Highlight. The name's hardcoded which is bad though. //Creates a delegate that call gridBuyView.ShopModel.SelectItemByIndex(-1), the test runner will run the function, and //check if an ArgumentOutOfRangeException is thrown, the unit test would fail if no ArgumentOutOfRangeException //was thrown - Assert.Throws(delegate - { - //shopView.OnSelected(item); // TODO: check items for selection in here - },"Error selecting specified item"); - Assert.IsFalse(true,"Previous item is still selected!"); + shopView.ShopModel.SelectItemByIndex(shopView.ShopModel.GetSelectedItemIndex() + 1); + var newHighlight = shopView.transform.Find("Highlight"); + + Assert.IsTrue(highlight != newHighlight,"Previous item is still selected!"); } } } \ No newline at end of file