public void DisplayPoducts() { JsonReader jsr = new JsonReader(); InventoryList il = (InventoryList)jsr.ReadInventoryFile("JSON\\owner_inventory.json"); //InventoryList il = new InventoryList(); il.PrintItems(); Console.WriteLine("\nPress Any Key To Continue\n"); Console.ReadLine(); }
public static void runTests() { JsonReader jsr = new JsonReader(); /* Testing Code starts here */ /*InventoryItem ii = new InventoryItem(); * ii.Id = 1; * ii.Name = "Rabbit"; * ii.StockLevel = 5; * * Console.WriteLine(ii.StockLevel); * ii.ReStock(5); * Console.WriteLine(ii.StockLevel); * ii.ReStock(-1); * Console.WriteLine(ii.StockLevel); * * //JsonReader jsr = new JsonReader(); * InventoryList il = (InventoryList)jsr.ReadInventoryFile("JSON\\owner_inventory.json"); * * try * { * il.PrintItems(); * Console.WriteLine("\n"); * il.Restock(1, 5); * il.PrintItems(); * //il.WriteToFile("JSON\\owner_inventory.json"); * } * catch (NullReferenceException) * { * Console.WriteLine("Invalid reference return"); * }*/ /* Test Stock Requests */ /*StockRequestList srl = (StockRequestList)jsr.ReadRequestFile("JSON\\stockRequests.json"); * try * { * srl.PrintItems(); * Console.WriteLine("\nprint filtered\n"); * srl.PrintFilteredItems(true); * Console.WriteLine("\nattempt process request 1\n"); * srl.ProcessRequest(1); * srl.PrintItems(); * } * catch (NullReferenceException) * { * Console.WriteLine("Invalid reference return"); * }*/ /* Test display all products */ InventoryList il = (InventoryList)jsr.ReadInventoryFile("JSON\\owner_inventory.json"); il.PrintItems(); il = (InventoryList)jsr.ReadInventoryFile("JSON\\CBD_Franchise_Inventory.json"); il.PrintFranchiseItems(4); il.PrintLowStock(4); Console.ReadLine(); /* Testing Code ends here*/ }