/// <summary> /// Prints out all the stores and lets the user choose which inventory they want to view /// </summary> /// <returns>List of stores</returns> public IActionResult _GetStoreInventory() { if (!_cache.TryGetValue("loggedInCustomer", out loggedInCustomer)) { //If the user isn't logged in, return to login screen return(View("_Login")); } var storeList = StoreMethods.SelectListOfStores(_db); return(View(storeList)); }
public void SelectListOfStoreCreatesListOfStores() { var options = new DbContextOptionsBuilder <SGDB2Context>() .UseInMemoryDatabase(databaseName: "SGDB2") .Options; using (var context = new SGDB2Context(options)) { var list = StoreMethods.SelectListOfStores(context); Assert.IsType <List <Stores> >(list); } }//11
public void SelectListOfStoreCreatesPopulatedList() { var options = new DbContextOptionsBuilder <SGDB2Context>() .UseInMemoryDatabase(databaseName: "SGDB2") .Options; using (var context = new SGDB2Context(options)) { Stores store = new Stores(); context.Stores.Add(store); context.SaveChanges(); var list = StoreMethods.SelectListOfStores(context); int isEmpty = list.Count; Assert.True(isEmpty > 0); } }//12