public async Task Insert_Button_And_Find_And_Delete_Test() { var client = new HistoryMapWebClient(user, pass); var record = new GenericLabelForWorldMap(new LocalDate(Era.BeforeCommon, 50, 5, 5), new Point(5, 5), "SomeType", new Dictionary <string, string>() { { "Key", "Value" } }, 50, 50, Guid.NewGuid().ToString()); //create record var a = await client.CreateRecord(record); Assert.IsTrue(a.Success); //Find record var allRecords = await client.GetButtons(); var inserted = allRecords.SingleOrDefault(p => p._id == record._id); Assert.IsNotNull(inserted); //Delete record var deleteResult = await client.Delete <GenericLabelForWorldMap>(record._id); Assert.IsTrue(deleteResult.Success); //Check deletion allRecords = await client.GetButtons(); inserted = allRecords.SingleOrDefault(p => p._id == record._id); Assert.IsNull(inserted); }
/// <summary> /// This rejects the selected record then refreshes the list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RejectBtn_Click(object sender, EventArgs e) { if (ItemsList.SelectedIndex == -1) { MessageBox.Show(@"Please select a item to reject first"); return; } if (ItemsList.SelectedIndex < _unverifiedBordersList.Count) { var border = _unverifiedBordersList[ItemsList.SelectedIndex]; border.Verified = true; _client.Delete <BorderStorageClass>(border._id).GetAwaiter(); } else { var button = _unverifiedButtonsList[ItemsList.SelectedIndex - _unverifiedBordersList.Count]; button.verified = true; _client.Delete <GenericLabelForWorldMap>(button._id).GetAwaiter(); } CreateFormInstance(true, true); }
/// <summary> /// This will delete the specified user from the db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeleteBtn_Click(object sender, EventArgs e) { if (UsersList.SelectedIndex == -1) { MessageBox.Show(@"Please select an index to delete"); return; } _client.Delete <UserClass>(_userList[UsersList.SelectedIndex]._id).GetAwaiter(); UsersList.SelectedIndex = -1; DeleteBtn.Enabled = false; SetupList(); }