public void GetInventoryCommand_Successful() { var expectedInterface = new Helpers.TestUserInterface( new List <System.Tuple <string, string> >(), new List <string> { "Gremlins \tQuantity:7", "Willowsong \tQuantity:3", }, new List <string>() ); var context = new TestInventoryContext(new Dictionary <string, Book> { { "Gremlins", new Book { Id = 1, Name = "Gremlins", Quantity = 7 } }, { "Willowsong", new Book { Id = 2, Name = "Willowsong", Quantity = 3 } }, }); var command = new GetInventoryCommand(expectedInterface, context); var(wasSuccessful, shouldQuit) = command.RunCommand(); Assert.IsFalse(shouldQuit, "GetInventory is not a terminating command."); Assert.IsTrue(wasSuccessful, "GetInventory did not complete Successfully."); Assert.AreEqual(0, context.GetAddedBooks().Length, "GetInventory should not have added any books."); Assert.AreEqual(0, context.GetUpdatedBooks().Length, "GetInventory should not have updated any books."); }
public void GetInventoryItems(WebRequestData args, Action <CommandResult> Callback) { if (args is GetInventoryRequestData localArgs) { CommandArgs commandArgs = new GetInventoryCommandArgs { Callback = Callback, DataStore = localArgs.DataStore, VirtualCurrency = localArgs.VirtualCurrency }; GetInventoryCommand command = CommandFactory .Instance .CreateCommand <GetInventoryCommand>(commandArgs); command.Execute(); } else { // Make more verbose exceptions throw new ArgumentException("Incorrect args data type;"); } }