public void DealStatusSummariesController_Get_Returns_OKResponseCode(DealSearchCriteria criteria) { #region Arrange SetupUserIdentity(); //Create mock repository var dealStatusSummariesRepository = new Mock <IDealStatusSummariesRepository>(); //Build response IList <Data.Models.grs_PrGetGrsDealCountByStatus> dealDbData = new List <Data.Models.grs_PrGetGrsDealCountByStatus> { new Data.Models.grs_PrGetGrsDealCountByStatus { StatusGroup = 3, StatusGroupName = "Bound - Pending Actions", StatusGroupSortOrder = 3, StatusCode = 1000, StatusName = "Bound - Pending Actions", StatusSortOrder = 1, Count = 1578, WorkflowID = 1, WorkflowName = "Default" } }; // Search method dealStatusSummariesRepository.Setup(p => p.GetAllDealStatusSummaries(It.IsAny <string>(), It.IsAny <string>())) .Returns(dealDbData); dealStatusSummariesRepository.Setup(p => p.ValidPerson(It.IsAny <int>())) .Returns(true); dealStatusSummariesRepository.Setup(x => x.GetGlobalReExposureTree()).Returns(new List <grs_VExposureTreeExt> { new grs_VExposureTreeExt { SubdivisionCode = 1, SubdivisionName = "Casualty", ProductLineCode = 1001, ProductLineName = "Auto Reins", ExposureGroupCode = 59, ExposureGroupName = "CA - Auto - Commercial", ExposureTypeCode = 5916, ExposureTypeName = "CA - Auto - Commercial - Non Trucking" }, new grs_VExposureTreeExt { SubdivisionCode = 2, SubdivisionName = "Casualty", ProductLineCode = 1001, ProductLineName = "Auto Reins", ExposureGroupCode = 59, ExposureGroupName = "CA - Auto - Commercial", ExposureTypeCode = 5922, ExposureTypeName = "CA - Auto - Commercial - Non Trucking" } }); //Manager DealStatusSummariesManager dealStatusSummariesManager = new DealStatusSummariesManager(userManager.Object, cacheStoreManager, mockLogManager.Object, dealStatusSummariesRepository.Object, transformationManager); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPGET), $"{AppSettings.BASEURL}{RouteHelper.DealStatusSummaryRoutePrefix}"); DealAPIManager dealAPIManager = new DealAPIManager(userManager.Object, cacheStoreManager, mockLogManager.Object, dealStatusSummariesManager); DealStatusSummariesController dealStatusSummariesController = new DealStatusSummariesController(userManager.Object, dealAPIManager) { Request = httpRequest, Configuration = new HttpConfiguration() }; #endregion #region Act var response = dealStatusSummariesController.GetAll(criteria); var contentResult = response as NegotiatedContentResult <ResponseCollection <DealStatusSummary> >; #endregion #region Assert #region Expected var expectedDealSummary = new DealStatusSummary { StatusCode = 1000, StatusName = "Bound - Pending Actions", SortOrder = 3, Count = 1578, WorkflowId = 1, WorkflowName = "Default" }; var expectedGetLink = new Link(LinkType.RelatedEntity, EntityType.Deals, $"v1/deals?statuscodes={expectedDealSummary.StatusCode}", HttpMethodType.GET); #endregion Assertions.AssertOkResponse(contentResult); var summaryData = contentResult.Content.results; for (int i = 0; i <= summaryData.Count - 1; i++) { //Data var actualDealSummary = summaryData[i].data; Assertions.AssertData(expectedDealSummary, actualDealSummary); //Links & Messages Assert.Multiple(() => { Assert.IsNotEmpty(summaryData[i].links); Assert.AreEqual(1, summaryData[i].links.Count); Assertions.AssertLink(expectedGetLink, summaryData[i].links[0]); }); Assert.IsEmpty(summaryData[i].messages); } #endregion }