public void TestExecuteParameterIsNotListBoxItem() { List <decimal> itemList = new List <decimal>(); RemoveItemCommand removeItemCommand = new RemoveItemCommand(itemList.RemoveAt); var exception = Assert.ThrowsException <ArgumentException>(() => { removeItemCommand.Execute(new TextBox()); }); Assert.AreEqual("parameter is not a ListBoxItem", exception.Message); }
public void TestExecute() { List <decimal> itemList = new List <decimal>() { 15.00M, 50.00M, 20.00M }; RemoveItemCommand removeItemCommand = new RemoveItemCommand(itemList.RemoveAt); ListBoxItem listBoxItem = new ListBoxItem() { Content = new Tuple <decimal, int>(50.00M, 1) }; removeItemCommand.Execute(listBoxItem); Assert.AreEqual(2, itemList.Count); Assert.AreEqual(15.00M, itemList[0]); Assert.AreEqual(20.00M, itemList[1]); }