public async Task Then_Returns_Ok_And_Response( int pledgeId, GetSectorQueryResult getSectorQueryResult, [Frozen] Mock <IMediator> mockMediator, [Greedy] OpportunityController opportunityController) { mockMediator .Setup(x => x.Send( It.IsAny <GetSectorQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(getSectorQueryResult); var controllerResult = await opportunityController.Sector(pledgeId); var okObjectResult = controllerResult as OkObjectResult; var response = okObjectResult.Value as GetSectorResponse; Assert.IsNotNull(controllerResult); Assert.IsNotNull(okObjectResult); Assert.IsNotNull(response); Assert.AreEqual(okObjectResult.StatusCode, (int)HttpStatusCode.OK); Assert.AreEqual(getSectorQueryResult.Sectors, response.Sectors); Assert.AreEqual(getSectorQueryResult.Opportunity.Id, response.Opportunity.Id); }