/// <summary> /// set up the ship info data /// </summary> private void SetShipInfoData() { this.gangwayLocation = new GangwayLocation { LocationId = "2365", LocationTypeId = "1", Name = "DK3 Mid Port" }; this.gangwayLocations = new Collection<GangwayLocation>(); this.gangwayLocations.Add(this.gangwayLocation); this.referenceDataRepository.Setup(data => data.RetrieveGangwayLocationListAsync("5")).Returns(Task.FromResult(this.gangwayLocations)); this.stateroomCategory = new StateroomCategory { StateroomCategoryType = "Inside Staterooms", StateroomCategoryTypeId = "1" }; var stateroomCategories = new ListResult<StateroomCategory>(); stateroomCategories.Items.Add(this.stateroomCategory); this.referenceDataRepository.Setup(data => data.RetrieveGangwayLocationListAsync("5")).Returns(Task.FromResult(this.gangwayLocations)); this.referenceDataRepository.Setup(data => data.RetrieveStateroomCategoryListAsync("5")).Returns(Task.FromResult(stateroomCategories)); }
private void SetupShipInfoData() { var location = new GangwayLocation { LocationId = "1", LocationTypeId = "123" }; var voyage = new Voyage { DebarkPortId = "2", DestinationId = "1", IsActive = true, EmbarkPortId = "2", Name = "Demo", ShipId = "5", Nights = 2 }; var stateroomCategory = new StateroomCategory { StateroomCategoryId = "1", Category = "123", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23", StateroomCategoryType = "EDE", StateroomCategoryTypeId = "2" }; var locations = new Collection<GangwayLocation>(); locations.Add(location); var voyages = new Collection<Voyage>(); voyages.Add(voyage); var stateroomCategories = new StateroomCategoryCollection(); stateroomCategories.Add(stateroomCategory); this.shipInfo.AssignGangwayLocations(locations); this.shipInfo.AssignStateroomCategories(stateroomCategories); this.shipInfo.AssignVoyageCollection(voyages); this.shipInfo.ShipId = "5"; }
/// <summary> /// Maps the gangway locations. /// </summary> /// <param name="dataReader">The data reader.</param> /// <returns>The collection of gangway location</returns> private static async Task<ICollection<GangwayLocation>> MapGangwayLocations(SqlDataReader dataReader) { var gangwayLocations = new Collection<GangwayLocation>(); if (dataReader != null) { while (await dataReader.ReadAsync()) { var gangwayLocation = new GangwayLocation { LocationId = dataReader.Int32Field(LocationId).ToString(), LocationTypeId = dataReader.ByteField(LocationTypeId).ToString(), Name = dataReader.StringField(Name) }; gangwayLocations.Add(gangwayLocation); } } return gangwayLocations.OrderBy(a => a.Name).ToList(); }