public async Task Then_Returns_Accounts( int opportunityId, string userId, GetSelectAccountQueryResult getSelectAccountQueryResult, [Frozen] Mock <IMediator> mockMediator, [Greedy] OpportunityController opportunityController) { mockMediator .Setup(x => x.Send(It.Is <GetSelectAccountQuery>(y => y.UserId == userId), It.IsAny <CancellationToken>())) .ReturnsAsync(getSelectAccountQueryResult); var controllerResult = await opportunityController.SelectAccount(opportunityId, userId) as OkObjectResult; var response = controllerResult.Value as GetSelectAccountResponse; Assert.IsNotNull(controllerResult); Assert.AreEqual(controllerResult.StatusCode, (int)HttpStatusCode.OK); Assert.IsNotNull(response); Assert.AreEqual(getSelectAccountQueryResult.Accounts.Count(), response.Accounts.Count()); }