public async Task UpdatePickupPoint_InvokeExpectedMethods()
        {
            await _service.UpdatePickupPoint(new PickupPoint());

            _repositoryMock.Verify(c => c.UpdateAsync(It.IsAny <PickupPoint>()), Times.Once);
            _cacheMock.Verify(c => c.RemoveByPrefix(It.IsAny <string>(), It.IsAny <bool>()), Times.AtLeast(1));
            _mediatorMock.Verify(c => c.Publish(It.IsAny <EntityUpdated <PickupPoint> >(), default(CancellationToken)), Times.Once);
        }
Esempio n. 2
0
        public async Task <IActionResult> EditPickupPoint(PickupPointModel model, bool continueEditing)
        {
            var pickupPoint = await _pickupPointService.GetPickupPointById(model.Id);

            if (pickupPoint == null)
            {
                //No pickup point found with the specified id
                return(RedirectToAction("PickupPoints"));
            }

            if (ModelState.IsValid)
            {
                pickupPoint = model.ToEntity(pickupPoint);
                await _pickupPointService.UpdatePickupPoint(pickupPoint);

                SuccessNotification(_localizationService.GetResource("Admin.Configuration.Shipping.PickupPoints.Updated"));
                return(continueEditing ? RedirectToAction("EditPickupPoint", new { id = pickupPoint.Id }) : RedirectToAction("PickupPoints"));
            }
            //If we got this far, something failed, redisplay form
            await PreparePickupPointModel(model);

            return(View(model));
        }