private void btnDeletePro_Click(object sender, EventArgs e) { string id = txtId.Text; if (!string.IsNullOrEmpty(id)) { promotionController.Delete(Int32.Parse(id)); MessageBox.Show("You deleted promotion successfully", "Notification"); loadTable(); } }
public async Task DeletePromotion_ReturnPromotion() { //arrange var promo = new Promotion { promotionId = 1, vendorId = 2, startDate = "01/16/1984", endDate = "02/16/1984", description = "promotion description!" }; _promoQueryMock.Setup(x => x.GetPromotion(1)) .Returns(Task.Factory.StartNew(() => promo)); _promoQueryMock.Setup(x => x.DeletePromotion(1)) .Returns(Task.Factory.StartNew(() => true)); // act var task = await _promoController.Delete(1); // assert Assert.IsType <OkObjectResult>(task); var result = task as OkObjectResult; var usersResult = result.Value as bool?; Assert.True(usersResult); }