Browse Source

Update selection unit test

master
Devin 4 years ago
parent
commit
535616bb04
  1. 10
      Assets/Scripts/Shop/Tests/ShopUnitTests.cs

10
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<System.Exception>(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!");
}
}
}
Loading…
Cancel
Save