public async void ListReturnsRequestUnathorized_WhenUserIsNotAnOrgAdmin() { var mediator = new Mock <IMediator>(); var sut = new UnlinkedRequestController(mediator.Object); sut.MakeUserNotAnOrgAdmin(); await sut.List(); Assert.IsType <UnauthorizedResult>(await sut.List()); }
public async void ListCallsRequestListItemsQueryWithUsersOrgId_WhenUserIsOrgAdmin() { var mediator = new Mock <IMediator>(); var validator = new Mock <IUnlinkedRequestViewModelValidator>(); var sut = new UnlinkedRequestController(mediator.Object, validator.Object); sut.MakeUserAnOrgAdmin(OrganizationId.ToString()); await sut.List(); mediator.Verify(x => x.SendAsync(It.Is <UnlinkedRequestListQuery>(y => y.OrganizationId == 1001)), Times.Once); }