public async Task GetContactSendsOrganizationContactQueryWithCorrectData() { const int organizationId = 1; var mediator = new Mock <IMediator>(); var sut = new OrganizationApiController(mediator.Object); await sut.GetContact(organizationId); mediator.Verify(x => x.SendAsync(It.Is <OrganizationContactQuery>(y => y.OrganizationId == organizationId && y.ContactType == ContactTypes.Primary))); }
public async Task GetContactReturnsCorrectModel() { var mediator = new Mock <IMediator>(); mediator.Setup(x => x.SendAsync(It.IsAny <OrganizationContactQuery>())).ReturnsAsync(new ContactInformationViewModel()); var sut = new OrganizationApiController(mediator.Object); var result = await sut.GetContact(It.IsAny <int>()); Assert.IsType <ContactInformationViewModel>(result); }