public async Task Remove_Post_RemovesCarrierFromNotification() { var model = new RemoveCarrierViewModel { CarrierId = carrierId, NotificationId = notificationId }; await carrierController.Remove(model); A.CallTo(() => mediator.SendAsync(A <DeleteCarrierForNotification> .That.Matches(p => p.CarrierId == carrierId && p.NotificationId == notificationId))) .MustHaveHappened(Repeated.Exactly.Once); }
public async Task Remove_WithBackToOverviewNull_DefaultsRouteValueToFalse() { var model = new RemoveCarrierViewModel { NotificationId = notificationId, CarrierId = carrierId }; var result = await carrierController.Remove(model, null) as RedirectToRouteResult; var backToOverviewKey = "backToOverview"; Assert.True(result.RouteValues.ContainsKey(backToOverviewKey)); Assert.False(Convert.ToBoolean(result.RouteValues[backToOverviewKey])); }
public async Task <ActionResult> Remove(Guid id, Guid entityId, bool?backToOverview = null) { ViewBag.BackToOverview = backToOverview.GetValueOrDefault(); var carrier = await mediator.SendAsync(new GetCarrierForNotification(id, entityId)); var model = new RemoveCarrierViewModel { CarrierId = carrier.Id, CarrierName = carrier.Business.Name, NotificationId = carrier.NotificationId }; return(View(model)); }
public async Task <ActionResult> Remove(RemoveCarrierViewModel model, bool?backToOverview = null) { try { await mediator.SendAsync(new DeleteCarrierForNotification(model.NotificationId, model.CarrierId)); await this.auditService.AddAuditEntry(this.mediator, model.NotificationId, User.GetUserId(), NotificationAuditType.Deleted, NotificationAuditScreenType.IntendedCarrier); } catch (ApiBadRequestException ex) { this.HandleBadRequest(ex); if (ModelState.IsValid) { throw; } } return(RedirectToAction("List", "Carrier", new { id = model.NotificationId, backToOverview })); }
public async Task<ActionResult> Remove(RemoveCarrierViewModel model, bool? backToOverview = null) { try { await mediator.SendAsync(new DeleteCarrierForNotification(model.NotificationId, model.CarrierId)); } catch (ApiBadRequestException ex) { this.HandleBadRequest(ex); if (ModelState.IsValid) { throw; } } return RedirectToAction("List", "Carrier", new { id = model.NotificationId, backToOverview }); }
public async Task<ActionResult> Remove(Guid id, Guid entityId, bool? backToOverview = null) { ViewBag.BackToOverview = backToOverview.GetValueOrDefault(); var carrier = await mediator.SendAsync(new GetCarrierForNotification(id, entityId)); var model = new RemoveCarrierViewModel { CarrierId = carrier.Id, CarrierName = carrier.Business.Name, NotificationId = carrier.NotificationId }; return View(model); }
public async Task Remove_WithBackToOverviewNull_DefaultsRouteValueToFalse() { var model = new RemoveCarrierViewModel { NotificationId = notificationId, CarrierId = carrierId }; var result = await carrierController.Remove(model, null) as RedirectToRouteResult; var backToOverviewKey = "backToOverview"; Assert.True(result.RouteValues.ContainsKey(backToOverviewKey)); Assert.False(Convert.ToBoolean(result.RouteValues[backToOverviewKey])); }
public async Task Remove_Post_RemovesCarrierFromNotification() { var model = new RemoveCarrierViewModel { CarrierId = carrierId, NotificationId = notificationId }; await carrierController.Remove(model); A.CallTo(() => mediator.SendAsync(A<DeleteCarrierForNotification>.That.Matches(p => p.CarrierId == carrierId && p.NotificationId == notificationId))) .MustHaveHappened(Repeated.Exactly.Once); }