private void SetupReferenceData()
        {
            var countries = new Country { CountryId = "1", Name = "USA", Code = "USA" };

            var states = new State { StateId = "2", CountryId = "1", Name = "Florida" };

            var ports = new Port { PortId = "1", City = "Florida", Name = "Miami", State = "Florida", StateId = "2", CountryId = "1" };

            var brands = new Brand { BrandId = "1", Name = "Carnival" };

            var personTypes = new PersonTypeEntity { PersonTypeId = "1001", Name = "Daniel" };

            var loyaltyLevelTypes = new LoyaltyLevelType { LoyaltyLevelTypeId = "1001", Name = "abc", BrandId = "1", NoOfCruiseNights = 3, LogoImageAddress = "abc" };

            var documentType = new DocumentType { CountryId = "232", Code = "USA", DocumentTypeId = "1", Name = "Passport" };

            var brand = new BrandCollection();

            var country = new CountryCollection();
            country.Add(countries);

            var state = new StateCollection();
            state.Add(states);

            var documentTypes = new DocumentTypeCollection();
            documentTypes.Add(documentType);

            var port = new PortCollection();
            port.Add(ports);

            var personTypeEntity = new PersonTypeEntityCollection();
            personTypeEntity.Add(personTypes);

            var loyaltyLevelType = new LoyaltyLevelTypeCollection();
            loyaltyLevelType.Add(loyaltyLevelTypes);

            this.referenceData.AssignBrands(brand);
            this.referenceData.AssignCountries(country);
            this.referenceData.AssignStates(state);
            this.referenceData.AssignDocumentTypes(documentTypes);
            this.referenceData.AssignLoyaltyLevelTypes(loyaltyLevelType);
            this.referenceData.AssignPersonTypes(personTypeEntity);
            this.referenceData.AssignPorts(port);
        }
        /// <summary>
        /// Setups the manager.
        /// </summary>
        private void SetupData()
        {
            var countries = new Country { CountryId = "1", Name = "USA", SourceCode = "USA", CountryFlagAddress = "http://localhost" };

            var states = new State { StateId = "2", CountryId = "1", Name = "Florida" };

            var ports = new Port { PortId = "1", City = "Florida", Name = "Miami", State = "Florida", StateId = "2", CountryId = "1" };

            var brands = new Brand { BrandId = "5", Name = "Carnival", MediaItemAddress = "http://localhost" };

            var personTypes = new PersonTypeEntity { PersonTypeId = "1001", Name = "Daniel" };

            var loyaltyLevelTypes = new LoyaltyLevelType { LoyaltyLevelTypeId = "1001", Name = "abc", BrandId = "1", NoOfCruiseNights = 3, LogoImageAddress = "ABC" };

            var documentType = new DocumentType { CountryId = "231", Code = "USA", DocumentTypeId = "1", Name = "Passport" };

            var brand = new ListResult<Brand>();
            brand.Items.Add(brands);

            var country = new ListResult<Country>();
            country.Items.Add(countries);

            var state = new ListResult<State>();
            state.Items.Add(states);

            var port = new ListResult<Port>();
            port.Items.Add(ports);

            var personTypeEntity = new ListResult<PersonTypeEntity>();
            personTypeEntity.Items.Add(personTypes);

            var loyaltyLevelType = new ListResult<LoyaltyLevelType>();
            loyaltyLevelType.Items.Add(loyaltyLevelTypes);

            var documentTypes = new ListResult<DocumentType>();
            documentTypes.Items.Add(documentType);

            this.referenceDataRepository.Setup(data => data.RetrieveBrandListAsync()).Returns(Task.FromResult(brand));
            this.referenceDataRepository.Setup(data => data.RetrieveCountryListAsync(It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(country));
            this.referenceDataRepository.Setup(data => data.RetrieveLoyaltyLevelTypeListAsync()).Returns(Task.FromResult(loyaltyLevelType));
            this.referenceDataRepository.Setup(data => data.RetrievePersonTypeListAsync()).Returns(Task.FromResult(personTypeEntity));
            this.referenceDataRepository.Setup(data => data.RetrievePortListAsync()).Returns(Task.FromResult(port));
            this.referenceDataRepository.Setup(data => data.RetrieveStateListAsync()).Returns(Task.FromResult(state));
            this.referenceDataRepository.Setup(data => data.RetrieveDocumentTypeListAsync()).Returns(Task.FromResult(documentTypes));
        }
        private void SetUpData()
        {
            Domain.Dependencies.Register();

            //Repository registration
            DIContainer.Instance.RegisterType<IRepository, OnlineRepository>(OnlineRepository.InstanceName);
            DIContainer.Instance.RegisterType<ReferenceDataRepository>(new ContainerControlledLifetimeManager());
            DIContainer.Instance.RegisterType<IPersonsClient, PersonsClientTest>();
            DIContainer.Instance.RegisterType<IGuestClient, GuestClientTest>();
            DIContainer.Instance.RegisterType<ICrewmemberClient, CrewmemberClientTest>();

            var workStation = DIContainer.Instance.Resolve<Workstation>();
            workStation.GangwayServiceBaseAddress = "http://Localhost/";
            var voyages = new List<Voyage>();
            voyages.Add(new Voyage { IsActive = true, VoyageId = "31", Number = "dd0", ShipId = "1" });
            workStation.AssignVoyageList(voyages);
            this.targetRepository = new PersonServiceRepository();

            workStation.MaxRecentPersonCount = 1;
            workStation.Ship = new Ship { ShipId = "1", BrandId = "3", Code = "3" };

            this.personTypes = new List<PersonType>();
            personTypes.Add(PersonType.Guest);

            this.boardingDetail = new BoardingDetail
            {
                GangwayLocation = "location",
                MachineName = "GWY terminal",
                PortName = "port",
                ShipId = "1",
                Status = "onboard",
                StatusTypeId = "1",
                UserId = "1"
            };
            var port = new Port { State = "state", PortId = "1", StateId = "1", Name = "port", City = "city", IsAtSea = true, Code = "code", CountryId = "1", MediaItem = new MediaItem { MediaItemAddress = "", MediaTypeId = "1" }, Description = "Description test" };
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Maps the ports.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>port collection.</returns>
        private static async Task<PortCollection> MapPorts(SqlDataReader dataReader)
        {
            var portCollection = new PortCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var port = new Port
                    {
                        PortId = dataReader.Int32Field(PortId).ToString(),
                        CountryId = dataReader.Int32Field(CountryId).ToString(),
                        Code = dataReader.StringField(Code),
                        City = dataReader.StringField(City),
                        State = dataReader.StringField(State),
                        StateId = dataReader.Int32NullableField(StateId).ToString(),
                        Description = dataReader.StringField(Description),
                        Name = dataReader.StringField(Name)
                    };

                    portCollection.Add(port);
                }
            }

            return portCollection;
        }