コード例 #1
0
        public void DeleteTest_Success()
        {
            InitializeMapper();

            var providerDto = CreateProviderDto();

            var postResult   = _controller.Post(providerDto).Result;
            var okPostResult = postResult as OkObjectResult;
            var provider     = okPostResult?.Value as ProviderDto;

            var deleteResult   = _controller.Delete(provider?.Id).Result;
            var okDeleteResult = deleteResult as OkObjectResult;
            var isDeleted      = (Boolean)okDeleteResult?.Value;

            Assert.True(isDeleted);
        }
コード例 #2
0
        public void TestDeleteProvider()
        {
            ProviderController pc = new ProviderController();

            System.Web.Mvc.ViewResult result = pc.Index(null);

            Provider c = ((IPagedList <Provider>)result.ViewData.Model).First();

            Assert.NotNull(c);

            //ask deletion action
            System.Web.Mvc.ActionResult providerAskDeletion = pc.Delete(c.ProviderID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), providerAskDeletion);

            //delete action
            System.Web.Mvc.ActionResult providerDeletion = pc.DeleteConfirmed(c.ProviderID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), providerDeletion);
        }
コード例 #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult sure;
                sure = MessageBox.Show("¿Estas seguro que desea eliminar los registros?", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (sure == DialogResult.OK)
                {
                    string IdPro;
                    string res = "";

                    foreach (DataGridViewRow row in dataList.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            IdPro = Convert.ToString(row.Cells[1].Value);
                            res   = ProviderController.Delete(Convert.ToInt32(IdPro));

                            if (res.Equals("Correcto"))
                            {
                                this.MessageOK("¡Se ha eliminado el registro correctamente!");
                            }
                            else
                            {
                                this.MessageError(res);
                            }
                        }
                    }
                    this.ShowData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
コード例 #4
0
 public void DeleteShouldReturnJson()
 {
     ////Act
     providerController.Delete(Guid.NewGuid(), "testSearchQueryId");
 }