public async Task DeleteShippingMethod_InvokeExpectedMethods()
        {
            await _service.DeleteShippingMethod(new ShippingMethod());

            _repositoryMock.Verify(c => c.DeleteAsync(It.IsAny <ShippingMethod>()), Times.Once);
            _cacheMock.Verify(c => c.RemoveByPrefix(It.IsAny <string>(), It.IsAny <bool>()), Times.AtLeast(1));
            _mediatorMock.Verify(c => c.Publish(It.IsAny <EntityDeleted <ShippingMethod> >(), default(CancellationToken)), Times.Once);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteMethod(string id)
        {
            var sm = await _shippingMethodService.GetShippingMethodById(id);

            if (sm == null)
            {
                //No shipping method found with the specified id
                return(RedirectToAction("Methods"));
            }

            await _shippingMethodService.DeleteShippingMethod(sm);

            SuccessNotification(_localizationService.GetResource("Admin.Configuration.Shipping.Methods.Deleted"));
            return(RedirectToAction("Methods"));
        }