public AddNotificationCommentsHandlerTests() { this.repo = A.Fake <INotificationCommentRepository>(); A.CallTo(() => repo.Add(A <NotificationComment> .Ignored)).Returns(Task.FromResult(true)); this.message = A.Fake <AddNotificationComment>(); this.handler = new AddNotificationCommentHandler(this.repo); }
public async Task <ActionResult> Add(AddCommentsViewModel model) { if (!ModelState.IsValid) { model.ModelIsValid = false; return(View(model)); } var request = new AddNotificationComment(model.NotificationId, User.GetUserId(), model.Comment, model.ShipmentNumber.GetValueOrDefault(), DateTime.Now); await this.mediator.SendAsync(request); return(RedirectToAction("Index", new { id = model.NotificationId, type = model.SelectedType })); }