protected override void OnSetup() { mockLoggingHelper = CreateMock <ILoggingHelper>(); mockDeliveryRouteIntegrationService = CreateMock <IDeliveryRouteIntegrationService>(); mockBlockSequenceDataService = CreateMock <IBlockSequenceDataService>(); mockPostCodedataService = CreateMock <IPostcodeDataService>(); deliveryUnitID = System.Guid.Parse("B51AA229-C984-4CA6-9C12-510187B81050"); operationalStateID = System.Guid.Parse("9C1E56D7-5397-4984-9CF0-CD9EE7093C88"); mockDeliveryRouteDataService = CreateMock <IDeliveryRouteDataService>(); var rmTraceManagerMock = new Mock <IRMTraceManager>(); rmTraceManagerMock.Setup(x => x.StartTrace(It.IsAny <string>(), It.IsAny <Guid>())); mockLoggingHelper.Setup(x => x.RMTraceManager).Returns(rmTraceManagerMock.Object); referenceDataCategoryDTOList = new List <Common.ReferenceDataCategoryDTO>() { new Common.ReferenceDataCategoryDTO() { CategoryName = ReferenceDataCategoryNames.OperationalObjectType, ReferenceDatas = new List <Common.ReferenceDataDTO>() { new Common.ReferenceDataDTO() { ReferenceDataName = null, ReferenceDataValue = ReferenceDataValues.OperationalObjectTypeDP, ID = Guid.Parse("4DBA7B39-D23E-493A-9B8F-B94D181A082F") }, new Common.ReferenceDataDTO() { ReferenceDataName = null, ReferenceDataValue = ReferenceDataValues.DeliveryUnit, ID = unitLocationTypeId } } } }; deliveryRouteDto = new RouteDTO() { }; actualDeliveryRouteResult = new List <RouteDataDTO>() { new RouteDataDTO() { ID = Guid.NewGuid(), RouteName = "RouteOne", RouteNumber = "R004341" }, new RouteDataDTO() { ID = Guid.NewGuid(), RouteName = "RouteTwo", RouteNumber = "R003414" }, }; actualRouteDataDTO = new RouteDataDTO() { RouteName = "Route 001", RouteNumber = "R003456" }; actualRouteLogSequencedPointsDataDTO = new List <RouteLogSequencedPointsDataDTO>() { new RouteLogSequencedPointsDataDTO() { StreetName = "Street001", BuildingNumber = 001 }, new RouteLogSequencedPointsDataDTO() { StreetName = "Street001", BuildingNumber = 002 }, }; actualRoueCount = 5; actualReferenceDataCategoryResult = new List <Common.ReferenceDataDTO>() { new Common.ReferenceDataDTO() { DataDescription = "Live", DisplayText = "Live", ReferenceDataName = "Live" } }; mockDeliveryRouteDataService.Setup(n => n.GetScenarioRoutes(It.IsAny <Guid>())).Returns(Task.FromResult(actualDeliveryRouteResult)); mockDeliveryRouteDataService.Setup(n => n.GetRoutesForAdvanceSearch(It.IsAny <string>(), It.IsAny <Guid>())).Returns(Task.FromResult(actualDeliveryRouteResult)); mockDeliveryRouteDataService.Setup(n => n.GetRoutesForBasicSearch(It.IsAny <string>(), It.IsAny <Guid>())).Returns(Task.FromResult(actualDeliveryRouteResult)); mockDeliveryRouteDataService.Setup(n => n.GetRouteCount(It.IsAny <string>(), It.IsAny <Guid>())).Returns(Task.FromResult(actualRoueCount)); mockDeliveryRouteDataService.Setup(n => n.GetRouteSummary(It.IsAny <Guid>(), It.IsAny <List <Common.ReferenceDataCategoryDTO> >())).Returns(Task.FromResult(actualRouteDataDTO)); mockDeliveryRouteDataService.Setup(n => n.GetSequencedRouteDetails(It.IsAny <Guid>())).Returns(Task.FromResult(actualRouteLogSequencedPointsDataDTO)); mockDeliveryRouteDataService.Setup(n => n.GetRoutesByLocation(It.IsAny <Guid>())).Returns(Task.FromResult(actualDeliveryRouteResult)); mockBlockSequenceDataService.Setup(n => n.SaveDeliveryPointRouteMapping(It.IsAny <Guid>(), It.IsAny <Guid>())); mockDeliveryRouteDataService.Setup(n => n.GetRouteByDeliverypoint(It.IsAny <Guid>())).Returns(Task.FromResult(actualRouteDataDTO)); mockDeliveryRouteIntegrationService.Setup(n => n.GetReferenceDataSimpleLists(It.IsAny <List <string> >())).Returns(Task.FromResult(referenceDataCategoryDTOList)); testCandidate = new DeliveryRouteBusinessService(mockDeliveryRouteDataService.Object, mockDeliveryRouteIntegrationService.Object, mockLoggingHelper.Object, mockBlockSequenceDataService.Object, mockPostCodedataService.Object); }
public DeliveryRouteController(IDeliveryRouteBusinessService deliveryRouteBusinessService, ILoggingHelper loggingHelper) { // Store injected dependencies this.loggingHelper = loggingHelper; this.deliveryRouteLogBusinessService = deliveryRouteBusinessService; }