Example #1
0
        private void btnPayUpdate_Click(object sender, EventArgs e)
        {
            currentPay = new PaymentType();
            currentPay.PaymentTypeID = (int)dgvPaymentType.SelectedRows[0].Cells[0].Value;

            currentPay.Description = txtPayUpdate.Text;
            _paymentTypeController.Update(currentPay);
            FillList();
        }
        public async void Update_NotFound()
        {
            PaymentTypeControllerMockFacade mock = new PaymentTypeControllerMockFacade();
            var mockResult = new Mock <UpdateResponse <ApiPaymentTypeResponseModel> >();

            mockResult.SetupGet(x => x.Success).Returns(false);
            mock.ServiceMock.Setup(x => x.Update(It.IsAny <int>(), It.IsAny <ApiPaymentTypeRequestModel>())).Returns(Task.FromResult <UpdateResponse <ApiPaymentTypeResponseModel> >(mockResult.Object));
            mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiPaymentTypeResponseModel>(null));
            PaymentTypeController controller = new PaymentTypeController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, new ApiPaymentTypeModelMapper());

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.Update(default(int), new ApiPaymentTypeRequestModel());

            response.Should().BeOfType <StatusCodeResult>();
            (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound);
            mock.ServiceMock.Verify(x => x.Get(It.IsAny <int>()));
        }
 public static String[] Update(String id, String oldType, String type)
 {
     String[] message = payment.Update(id, oldType, type);
     return(message);
 }