public async Task InsertPickupPoint_InvokeExpectedMethods()
        {
            await _service.InsertPickupPoint(new PickupPoint());

            _repositoryMock.Verify(c => c.InsertAsync(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 <EntityInserted <PickupPoint> >(), default(CancellationToken)), Times.Once);
        }
Esempio n. 2
0
        public async Task <IActionResult> CreatePickupPoint(PickupPointModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var pickuppoint = model.ToEntity();
                await _pickupPointService.InsertPickupPoint(pickuppoint);

                SuccessNotification(_localizationService.GetResource("Admin.Configuration.Shipping.PickupPoints.Added"));
                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));
        }