public async Task UpdateDeliveryDate_InvokeExpectedMethods() { await _service.UpdateDeliveryDate(new DeliveryDate()); _repositoryMock.Verify(c => c.UpdateAsync(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 <EntityUpdated <DeliveryDate> >(), default(CancellationToken)), Times.Once); }
public async Task <IActionResult> EditDeliveryDate(DeliveryDateModel model, bool continueEditing) { var deliveryDate = await _deliveryDateService.GetDeliveryDateById(model.Id); if (deliveryDate == null) { //No delivery date found with the specified id return(RedirectToAction("DeliveryDates")); } if (ModelState.IsValid) { deliveryDate = model.ToEntity(deliveryDate); await _deliveryDateService.UpdateDeliveryDate(deliveryDate); //locales SuccessNotification(_localizationService.GetResource("Admin.Configuration.Shipping.DeliveryDates.Updated")); return(continueEditing ? RedirectToAction("EditDeliveryDate", new { id = deliveryDate.Id }) : RedirectToAction("DeliveryDates")); } //If we got this far, something failed, redisplay form return(View(model)); }