private void SetUpData() { Domain.Dependencies.Register(); //Repository registration DIContainer.Instance.RegisterType<IRepository, OnlineRepository>(OnlineRepository.InstanceName); DIContainer.Instance.RegisterType<ReferenceDataRepository>(new ContainerControlledLifetimeManager()); DIContainer.Instance.RegisterType<IComponentSettingsClient, ComponentSettingsClientTest>(); var workStation = DIContainer.Instance.Resolve<Workstation>(); workStation.ConfigurationServiceBaseAddress = "http://Localhost/"; workStation.Ship = new Ship { ShipId = "1", BrandId = "3", Code = "3" }; workStation.ConnectionMode = ConnectionMode.Online; var intCollection = new Collection<int>(); intCollection.Add(1); intCollection.Add(2); intCollection.Add(3); var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" }; brand.AssignPortIds(intCollection); workStation.Brand = brand; workStation.Voyage = new Voyage { IsActive = true, VoyageId = "31", Number = "dd0", ShipId = "1" }; var voyages = new List<Voyage>(); voyages.Add(new Voyage { IsActive = true, VoyageId = "31", Number = "dd0", ShipId = "1" }); workStation.AssignVoyageList(voyages); this.targetRepository = new ConfigurationServiceRepository(); }
/// <summary> /// Setups the data. /// </summary> private void SetupData() { // Repository registration Domain.Dependencies.Register(); DataAccess.Dependencies.Register(); Workstation ws = DIContainer.Instance.Resolve<Workstation>(); ws.Port = new Port { PortId = "1" }; ws.Ship = new Ship { ShipId = "1" }; ws.GangwayLocation = new GangwayLocation { LocationId = "1" }; ws.GangwayServiceBaseAddress = "http://Localhost/"; ws.ConfigurationServiceBaseAddress = "http://Localhost/"; ws.AuthenticationServiceBaseAddress = "http://Localhost/"; ws.AuthorizationServiceBaseAddress = "http://Localhost/"; ws.User.UserFullName = "DC-Dev60"; ws.ConnectionMode = ConnectionMode.Online; this.intCollection = new Collection<int>(); intCollection.Add(0); var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" }; brand.AssignPortIds(intCollection); ws.Brand = brand; this.workStation = ws; this.repository = new Mock<GangwayEventRepository>(); this.embarkationStatisticsRepositoryMock = new Mock<EmbarkationStatisticsRepository>(); this.personServiceRepositoryMock = new Mock<PersonServiceRepository>(); this.photoCaptureRepositoryMock = new Mock<PhotoCaptureRepository>(); this.shipTimeRepositoryMock = new Mock<ShipTimeRepository>(); this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>(); this.gangwayEventRepositoryMock = new Mock<GangwayEventRepository>(); DIContainer.Instance.RegisterType<IPersonsClient, PersonsClientTest>(); DIContainer.Instance.RegisterType<IGuestClient, GuestClientTest>(); DIContainer.Instance.RegisterInstance<GangwayEventRepository>(this.repository.Object); ////DIContainer.Instance.RegisterInstance<ReferenceDataRepository>(this.referenceDataRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<EmbarkationStatisticsRepository>(this.embarkationStatisticsRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<GangwayEventRepository>(this.gangwayEventRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<PhotoCaptureRepository>(this.photoCaptureRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<PersonServiceRepository>(this.personServiceRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<ShipTimeRepository>(this.shipTimeRepositoryMock.Object); var boardingDetail = new BoardingDetail { GangwayLocation = "location", MachineName = "GWY terminal", PortName = "port", ShipId = "1", Status = "onboard", StatusTypeId = "1", UserId = "1" }; var personEvent = new PersonEvent { PersonId = "123", ApplicationId = "1" }; this.repository.Setup(a => a.CreateEventAsync(personEvent)).Returns(Task.FromResult("Successful")); }
/// <summary> /// Setups the data. /// </summary> private void SetupData() { Domain.Dependencies.Register(); DataAccess.Dependencies.Register(); Workstation ws = DIContainer.Instance.Resolve<Workstation>(); ws.Port = new Port { PortId = "1" }; ws.Ship = new Ship { ShipId = "1" }; ws.GangwayLocation = new GangwayLocation { LocationId = "1" }; ws.GangwayServiceBaseAddress = "http://Localhost/"; ws.ConnectionMode = ConnectionMode.Online; ws.ConfigurationServiceBaseAddress = "http://Localhost/"; ws.AuthenticationServiceBaseAddress = "http://Localhost/"; ws.AuthorizationServiceBaseAddress = "http://Localhost/"; var intCollection = new Collection<int>(); intCollection.Add(0); var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" }; brand.AssignPortIds(intCollection); ws.Brand = brand; ////this.repository = new Mock<IRepository>(); ////this.embarkationStatisticsRepositoryMock = new Mock<EmbarkationStatisticsRepository>(); ////this.personServiceRepositoryMock = new Mock<PersonServiceRepository>(); ////this.photoCaptureRepositoryMock = new Mock<PhotoCaptureRepository>(); ////this.shipTimeRepositoryMock = new Mock<ShipTimeRepository>(); this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>(); ////this.gangwayEventRepositoryMock = new Mock<GangwayEventRepository>(); ////this.referenceDataClient = new Mock<IReferenceDataClient>(); ////this.shipClient = new Mock<IShipClient>(); ////DIContainer.Instance.RegisterInstance<IReferenceDataClient>(this.referenceDataClient.Object); ////DIContainer.Instance.RegisterInstance<IShipClient>(this.shipClient.Object); ////DIContainer.Instance.RegisterInstance<IRepository>(this.repository.Object); DIContainer.Instance.RegisterInstance<ReferenceDataRepository>(this.referenceDataRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<EmbarkationStatisticsRepository>(this.embarkationStatisticsRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<GangwayEventRepository>(this.gangwayEventRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<PhotoCaptureRepository>(this.photoCaptureRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<PersonServiceRepository>(this.personServiceRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<ShipTimeRepository>(this.shipTimeRepositoryMock.Object); this.service = new ReferenceDataService(); this.referenceDataRepositoryMock.Setup(data => data.RetrieveReferenceDataAsync()).Returns(Task.FromResult(this.referenceData)); this.referenceDataRepositoryMock.Setup(data => data.RetrieveShipInfoAsync("5", false)).Returns(Task.FromResult(this.shipInfo)); this.referenceDataRepositoryMock.Setup(data => data.RetrieveShipListAsync("3", "5", "1")).Returns(Task.FromResult(this.shipList)); ////var referenceData = @"{""Countries"":[{""CountryId"":""1"",""Code"":""AF"",""Name"":""Afghanistan"",""CountryFlagAddress"":""http://devweb03.decurtis.com/ImagingMediaService/MediaItems/1""}]}"; ////this.referenceDataClient.Setup(data => data.RetrieveReferenceDataAsync()).Returns(Task.FromResult(referenceData)); ////this.referenceDataClient.Setup(data => data.RetrieveShipInfoAsync("5")).Returns(Task.FromResult(@"{""PreviousPageAddress"":null,""NextPageAddress"":null,""Items"":[{""ShipId"":""5"",""BrandId"":""3"",""Code"":""H6403"",""Name"":""Carnival Breeze"",""MediaItemAddress"":""http://devweb03.decurtis.com/ImagingMediaService/MediaItems/304004""}],""TotalResults"":1}")); ////this.shipClient.Setup(data => data.RetrieveShipListAsync(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<string>(), 0, 0)).Returns(this.RetrieveShipAsync()); }
/// <summary> /// Setups the data. /// </summary> private void SetupData() { Domain.Dependencies.Register(); DataAccess.Dependencies.Register(); Workstation ws = DIContainer.Instance.Resolve<Workstation>(); ws.Port = new Port { PortId = "1" }; ws.Ship = new Ship { ShipId = "1" }; ws.GangwayLocation = new GangwayLocation { LocationId = "1" }; ws.GangwayServiceBaseAddress = "http://Localhost/"; ws.ConfigurationServiceBaseAddress = "http://Localhost/"; ws.AuthenticationServiceBaseAddress = "http://Localhost/"; ws.AuthorizationServiceBaseAddress = "http://Localhost/"; ws.ConnectionMode = ConnectionMode.Online; ws.GangwayServiceBaseAddress = "http://Localhost/"; ws.ConfigurationServiceBaseAddress = "http://Localhost/"; ws.AuthenticationServiceBaseAddress = "http://Localhost/"; ws.AuthorizationServiceBaseAddress = "http://Localhost/"; var intCollection = new Collection<int>(); intCollection.Add(0); var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" }; brand.AssignPortIds(intCollection); ws.Brand = brand; this.embarkationStatistics = new EmbarkationStatistics { CrewEmbarkation = new CrewEmbarkStats { Ashore = 100, SignIn = 50, DebarkingToday = 50, ExpectedToday = 150, Onboard = 100, TotalOccupancy = 500 }, GuestEmbarkation = new GuestEmbarkStats { Ashore = 100, CheckedIn = 400, DebarkingToday = 140, ExpectedToday = 400, NotCheckedIn = 200, Onboard = 100, TotalOccupancy = 300 }, VisitorEmbarkation = new VisitorEmbarkStats { ExpectedToday = 100, Onboard = 50 }, CurrentBoardingNumber = 8 }; embarkationStatistics.AssignCountryEmbarkStats(intCollection); this.repository = new Mock<IRepository>(); this.embarkationStatisticsRepositoryMock = new Mock<EmbarkationStatisticsRepository>(); this.personServiceRepositoryMock = new Mock<PersonServiceRepository>(); this.photoCaptureRepositoryMock = new Mock<PhotoCaptureRepository>(); this.shipTimeRepositoryMock = new Mock<ShipTimeRepository>(); this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>(); this.gangwayEventRepositoryMock = new Mock<GangwayEventRepository>(); this.embarkationStatisticsClient = new Mock<IEmbarkationStatisticsClient>(); DIContainer.Instance.RegisterInstance<IEmbarkationStatisticsClient>(this.embarkationStatisticsClient.Object); DIContainer.Instance.RegisterInstance<IRepository>(this.repository.Object); DIContainer.Instance.RegisterInstance<ReferenceDataRepository>(this.referenceDataRepositoryMock.Object); DIContainer.Instance.RegisterInstance<EmbarkationStatisticsRepository>(this.embarkationStatisticsRepositoryMock.Object); DIContainer.Instance.RegisterInstance<GangwayEventRepository>(this.gangwayEventRepositoryMock.Object); DIContainer.Instance.RegisterInstance<PhotoCaptureRepository>(this.photoCaptureRepositoryMock.Object); DIContainer.Instance.RegisterInstance<PersonServiceRepository>(this.personServiceRepositoryMock.Object); DIContainer.Instance.RegisterInstance<ShipTimeRepository>(this.shipTimeRepositoryMock.Object); this.embarkationStatisticsRepositoryMock.Setup(data => data.RetrieveEmbarkationStatisticsAsync(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(this.embarkationStatistics)); ////this.embarkationStatisticsClient.Setup(data => data.RetrieveEmbarkationStatisticsAsync(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult("{CurrentBoardingNumber:8}")); }
/// <summary> /// Setups the data. /// </summary> private void SetupData() { Domain.Dependencies.Register(); DataAccess.Dependencies.Register(); Workstation ws = DIContainer.Instance.Resolve<Workstation>(); ws.Port = new Port { PortId = "1" }; ws.Ship = new Ship { ShipId = "1" }; ws.GangwayLocation = new GangwayLocation { LocationId = "1" }; ws.GangwayServiceBaseAddress = "http://Localhost/"; ws.ConfigurationServiceBaseAddress = "http://Localhost/"; ws.AuthenticationServiceBaseAddress = "http://Localhost/"; ws.AuthorizationServiceBaseAddress = "http://Localhost/"; ws.ConnectionMode = ConnectionMode.Online; var intCollection = new Collection<int>(); intCollection.Add(0); var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" }; brand.AssignPortIds(intCollection); ws.Brand = brand; ////this.repository = new Mock<IRepository>(); ////this.embarkationStatisticsRepositoryMock = new Mock<EmbarkationStatisticsRepository>(); ////this.personServiceRepositoryMock = new Mock<PersonServiceRepository>(); ////this.photoCaptureRepositoryMock = new Mock<PhotoCaptureRepository>(); ////this.shipTimeRepositoryMock = new Mock<ShipTimeRepository>(); ////this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>(); this.gangwayEventRepositoryMock = new Mock<GangwayEventRepository>(); ////this.gangwayHistoryClient = new Mock<IGangwayHistoryClient>(); ////this.personsClient = new Mock<IPersonsClient>(); ////this.guestClient = new Mock<IGuestClient>(); ////DIContainer.Instance.RegisterInstance<IGuestClient>(this.guestClient.Object); ////DIContainer.Instance.RegisterInstance<IPersonsClient>(this.personsClient.Object); ////DIContainer.Instance.RegisterInstance<IGangwayHistoryClient>(this.gangwayHistoryClient.Object); ////DIContainer.Instance.RegisterInstance<IRepository>(this.repository.Object); ////DIContainer.Instance.RegisterInstance<ReferenceDataRepository>(this.referenceDataRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<EmbarkationStatisticsRepository>(this.embarkationStatisticsRepositoryMock.Object); DIContainer.Instance.RegisterInstance<GangwayEventRepository>(this.gangwayEventRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<PhotoCaptureRepository>(this.photoCaptureRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<PersonServiceRepository>(this.personServiceRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<ShipTimeRepository>(this.shipTimeRepositoryMock.Object); ////this.service = new GangwayEventService(); var gangwayHistoryData = new ListResult<GangwayHistory>(); var gangwayHistory = new GangwayHistory { AlertCode = "1", AuthorizedAdultPersonId = "123", AuthorizedFirstName = "Demo", AuthorizedLastName = "demo", AuthorizedAdultPersonType = "1", ChargeId = "1", MachineName = "DC-Dev", PersonId = "123" }; gangwayHistoryData.Items.Add(gangwayHistory); gangwayHistoryData.TotalResults = 1; this.gangwayEventRepositoryMock.Setup(a => a.RetrieveGangwayHistoryListAsync(It.IsNotNull<string>(), It.IsNotNull<string>(), 0, 0)).Returns(Task.FromResult(gangwayHistoryData)); ////var gangwayHistoryData = @"{""ShipId"":""1"",""GangwayLocations"":[{""LocationId"":""1"",""LocationTypeId"":""1"",""Name"":""DK1""},""Voyages"":[{""VoyageId"":""8"",""ShipId"":""1"",""Number"":""SH201503200008"",""Name"":""8 Night Eastern"",""EmbarkDate"":""2015 - 03 - 20T00: 00:00"",""DebarkDate"":""2015 - 03 - 28T00: 00:00"",""EmbarkPortId"":""1"",""DebarkPortId"":""1"",""Nights"":8,""DestinationId"":""9"",""IsActive"":true,""MediaItemAddress"":""http://devweb03.decurtis.com/ImagingMediaService/MediaItems/2"",""Itineraries"":[{""VoyageItineraryId"":""29"",""Day"":2,""IsSeaDay"":true,""PortId"":"""",""ArrivalTime"":null,""DepartureTime"":null,""GangwayOpeningTime"":null,""GangwayClosingTime"":null}]}],""StateroomCategories"":[]}"; ////this.gangwayHistoryClient.Setup(data => data.RetrieveGangwayHistoryListAsync(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<string>(), null, null, 0, 0)).Returns(Task.FromResult(gangwayHistoryData)); }
private void SetUpData() { Domain.Dependencies.Register(); DataAccess.Dependencies.Register(); Workstation ws = DIContainer.Instance.Resolve<Workstation>(); ws.Port = new Port { PortId = "1" }; ws.Ship = new Ship { ShipId = "1" }; ws.GangwayLocation = new GangwayLocation { LocationId = "1" }; ws.GangwayServiceBaseAddress = "http://Localhost/"; ws.ConfigurationServiceBaseAddress = "http://Localhost/"; ws.AuthenticationServiceBaseAddress = "http://Localhost/"; ws.AuthorizationServiceBaseAddress = "http://Localhost/"; ws.ConnectionMode = ConnectionMode.Online; var intCollection = new Collection<int>(); intCollection.Add(0); var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" }; brand.AssignPortIds(intCollection); ws.Brand = brand; this.personServiceRepositoryMock = new Mock<PersonServiceRepository>(); this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>(); DIContainer.Instance.RegisterInstance<ReferenceDataRepository>(this.referenceDataRepositoryMock.Object); DIContainer.Instance.RegisterInstance<PersonServiceRepository>(this.personServiceRepositoryMock.Object); this.personServiceRepositoryMock.Setup(data => data.RetrievePersonsBySearchText(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<IList<PersonType>>(), It.IsAny<SearchType>(), null, null, 0, 0, null, null)).Returns(Task.FromResult(this.person)); this.personTypes = new List<PersonType>(); personTypes.Add(PersonType.Guest); var documentTypes = new DocumentTypeCollection(); documentTypes.Add(new DocumentType { CountryId = "232", Code = "USA", DocumentTypeId = "1", Name = "Passport" }); var referencedata = new ReferenceData(); referencedata.AssignDocumentTypes(documentTypes); this.referenceDataRepositoryMock.Setup(data => data.RetrieveReferenceDataAsync()).Returns(Task.FromResult(referencedata)); }