public void CreatePostShouldInsertOrganization() { // Arrange CreateSut(); OrganizationEditModel model = AgincourtAware; IRequest <int> command = new OrganizationEditCommand() { Organization = model }; _mediator.Setup(y => y.Send(It.IsAny <OrganizationNameUniqueQuery>())).Returns(() => { return(true); }); _mediator.Setup(x => x.Send(It.IsAny <OrganizationEditCommand>())).Returns(() => { IRequestHandler <OrganizationEditCommand, int> handler = new OrganizationEditCommandHandler(Context); return(handler.Handle((OrganizationEditCommand)command)); }); // Act _sut.Edit(model); // Assert Assert.Single(Context.Organizations.Where(t => t.Name == model.Name)); }
public void CreatePostShouldInsertOrganization() { // Arrange CreateSut(); OrganizationEditModel model = AgincourtAware; IRequest<int> command = new OrganizationEditCommand() { Organization = model }; _mediator.Setup(x => x.Send(It.IsAny<OrganizationEditCommand>())).Returns(() => { IRequestHandler<OrganizationEditCommand, int> handler = new OrganizationEditCommandHandler(Context); return handler.Handle((OrganizationEditCommand)command); }); // Act _sut.Edit(model); // Assert Assert.Single(Context.Organizations.Where(t => t.Name == model.Name)); }