public async void Edit() { TablesController tCtrl = new TablesController(); VenuesController vCtrl = new VenuesController(); tablesGUI = TablesGUI.Instance; Venue venue = null; try { // Finding venue from venueID on table and adding it to combobox. editedTable = await tCtrl.Get(tablesGUI.idFromTable); venue = await vCtrl.Get(editedTable.VenueId); // Creating a list because combobox demands it. var venuesList = new List <Venue>(); venuesList.Add(venue); lblTitle.Text = "Edit Table"; create = false; BtnSaveChanges.Text = "Save changes"; tbSeats.Text = "" + editedTable.NoOfSeats; tbName.Text = editedTable.Name; cbVenue.DataSource = venuesList; } catch (Exception) { MessageBox.Show("No connection to service"); this.Visible = false; } // Resetting idFromTable to remove possibility to show other employees tables tablesGUI.idFromTable = -1; }
public void GetAllCallsGetByIdOp() { var obj = new { a = 1 }; Ops.Setup(c => c.GetById("conn", "tbl", LoggingService, "14")) .Returns(obj); var controller = new TablesController(Ops.Object, LoggingService, _queryStringService); dynamic results = controller.Get("conn", "tbl", "14"); Assert.AreEqual(1, results.a); }
public void GetAllCallsGetAllOpUsesApplyQuery() { var list = new List <object> { new { a = 1 } }.AsQueryable(); Ops.Setup(c => c.GetAll("conn", "tbl", LoggingService)) .Returns((list, 0)); var controller = new TablesController(Ops.Object, LoggingService, _queryStringService); var results = controller.Get("conn", "tbl"); CollectionAssert.AreEqual(new List <object>(), results.ToList()); }