public async Task DeleteDeliveryDate_InvokeExpectedMethods()
        {
            await _service.DeleteDeliveryDate(new DeliveryDate());

            _repositoryMock.Verify(c => c.DeleteAsync(It.IsAny <DeliveryDate>()), Times.Once);
            _cacheMock.Verify(c => c.RemoveByPrefix(It.IsAny <string>(), It.IsAny <bool>()), Times.AtLeast(1));
            _mediatorMock.Verify(c => c.Publish(It.IsAny <EntityDeleted <DeliveryDate> >(), default(CancellationToken)), Times.Once);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> DeleteDeliveryDate(string id)
        {
            var deliveryDate = await _deliveryDateService.GetDeliveryDateById(id);

            if (deliveryDate == null)
            {
                //No delivery date found with the specified id
                return(RedirectToAction("DeliveryDates"));
            }
            if (ModelState.IsValid)
            {
                await _deliveryDateService.DeleteDeliveryDate(deliveryDate);

                SuccessNotification(_localizationService.GetResource("Admin.Configuration.Shipping.DeliveryDates.Deleted"));
                return(RedirectToAction("DeliveryDates"));
            }
            ErrorNotification(ModelState);
            return(RedirectToAction("EditDeliveryDate", new { id = id }));
        }