Exemplo n.º 1
0
        public void Set_DepartureLocations_Default_Ids_Populated()
        {
            var locations = BlazePortContext.GenerateLocations().ToArray();

            locations[0].Id = GUID1;
            locations[1].Id = GUID2;

            var uut = new TripConfigurationModel
            {
                DepartureLocations = locations
            };

            uut.DepartureLocation.Id.Should().Be(GUID1);
            uut.DeparturePort.Id.Should().Be(4);
            uut.ArrivalLocation.Id.Should().Be(GUID2);
            uut.ArrivalPort.Id.Should().Be(13);
        }
Exemplo n.º 2
0
        public void Setting_DepartureLocationId_Excludes_Duplicate_From_ArrivalLocations()
        {
            // arrange
            var locations = BlazePortContext.GenerateLocations().ToArray();

            locations[0].Id = GUID1;

            // act
            var uut = new TripConfigurationModel
            {
                DepartureLocations = locations
            };

            uut.SelectedDepartureLocationId = GUID1;

            // assert
            uut.ArrivalLocations.Select(al => al.Id).Should().NotContain(GUID1);
        }
Exemplo n.º 3
0
        public void Setting_SelectedArrivalLocationId_Sets_PortId()
        {
            // arrange
            var locations = BlazePortContext.GenerateLocations().ToArray();

            locations[1].Id = GUID2;

            // act
            var uut = new TripConfigurationModel
            {
                DepartureLocations = locations
            };

            uut.SelectedArrivalLocationId = GUID2;

            // assert
            uut.ArrivalPort.Id.Should().Be(13);
        }
Exemplo n.º 4
0
        public void Resetting_SelectedDepartureLocationId_After_Setting_SelectedDeparturePortId_Sets_Default_Id()
        {
            // arrange
            var locations = BlazePortContext.GenerateLocations().ToArray();

            locations[0].Id = GUID1;
            locations[1].Id = GUID2;

            // act
            var uut = new TripConfigurationModel
            {
                DepartureLocations = locations
            };

            uut.SelectedDepartureLocationId = GUID2;
            uut.SelectedDeparturePortId     = uut.DepartureLocations.First(l => l.Id == GUID2).Ports[0].Name;

            uut.SelectedDepartureLocationId = GUID1;

            // assert
            uut.DeparturePort.Name.Should().Be("Cape Canaveral Air Force Station");
        }