コード例 #1
0
        public void Clone_WhenInstanceCloned_ThenInstancesHashCodesAreEqual()
        {
            // arrange
            FlightPlanBuilder builder = FlightPlanBuilder.Create()
                                        .WithActualDepartureTime(1)
                                        .WithAircraft("B738")
                                        .WithAlternateAerodrome(new Aerodrome("LZKZ"))
                                        .WithCruisingLevel("320")
                                        .WithCruisingSpeed("250")
                                        .WithDepartureAerodrome(new Aerodrome("LZKZ"))
                                        .WithDepartureTime(2)
                                        .WithDestinationAerodrome(new Aerodrome("LZIB"))
                                        .WithEETHours(2)
                                        .WithEETMinutes(0)
                                        .WithEnduranceHours(5)
                                        .WithEnduranceMinutes(2)
                                        .WithFlightRules(FlightRules.IFR)
                                        .WithOtherInfo("NONE")
                                        .WithPersonsOnBoard(20)
                                        .WithRevision(22)
                                        .WithRoute("route")
                                        .WithSecondAlternateAerodrome(new Aerodrome("EPWA"))
                                        .WithTypeOfFlight(FlightType.GeneralAviation);

            FlightPlan instance0 = builder.Build();

            object instance1 = instance0.Clone();

            // act
            int result0 = instance0.GetHashCode();
            int result1 = instance1.GetHashCode();

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(instance1, Is.InstanceOf <FlightPlan>());
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(Equals(result0, result1), Is.True);
        }