private void Btn_Edit_Click(object sender, RoutedEventArgs e)
        {
            Airport selectedAirport = (Airport)DGAirport.SelectedItem;

            if (SelectedAirport(selectedAirport))
            {
                Airport           oldAirport = selectedAirport.Clone() as Airport;
                EditAirportWindow eaw        = new EditAirportWindow(selectedAirport, EditAirportWindow.Option.EDIT);
                if (eaw.ShowDialog() != true)
                {
                    int index = IndexOfSelectedAirport(oldAirport.AirportID);
                    Data.Instance.Airports[index] = oldAirport;
                }
                else
                {
                    selectedAirport.Change();
                }
            }
        }
Пример #2
0
        public void Clone_WhenInstanceCloned_ThenInstancesAreEqual()
        {
            // arrange
            AirportBuilder builder = AirportBuilder.Create()
                                     .WithATIS("A")
                                     .WithICAO("LZKZ");

            Airport instance0 = builder.Build();

            object instance1 = instance0.Clone();

            // act
            bool result = Equals(instance0, instance1);

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(instance1, Is.InstanceOf <Airport>());
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(result, Is.True);
        }