/// <summary> /// Serves as a hash function for a particular type. <see cref="M:System.Object.GetHashCode"></see> is suitable for use in hashing algorithms and data structures like a hash table. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"></see>. /// </returns> public override int GetHashCode() { return(base.GetHashCode() ^ _polarisation.GetHashCode() ^ _symbolRate.GetHashCode() ^ _switchingFrequency.GetHashCode() ^ _disEqc.GetHashCode() ^ _bandType.GetHashCode() ^ SatelliteIndex.GetHashCode() ^ _modulation.GetHashCode() ^ _innerFecRate.GetHashCode() ^ _pilot.GetHashCode() ^ _rollOff.GetHashCode()); }
public void GetHashCode_WhenTwoDifferentInstancesAreCreated_ThenInstanceHashCodesAreNotEqual() { // arrange PilotBuilder builder = PilotBuilder.Create() .WithAdministrativeVersion(AdministrativeRating.Observer) .WithCallsign("RYR2WQ") .WithClientRating(2) .WithConnectionTime(DateTime.Now) .WithFlightPlan(null) .WithFlightSimulator(FlightSimulator.Fly) .WithGroundSpeed(20) .WithHeading(222) .WithIsOnGround(true) .WithLocation(null) .WithName("name") .WithPlaneMTL("mtl") .WithProtocol("protocol") .WithRating(PilotRating.AirlineTransportPilot) .WithServer("server") .WithSoftwareName("sw name") .WithSoftwareVersion("1.2.3.4") .WithTransponderCode("7200") .WithVID("4321"); PilotBuilder builder1 = PilotBuilder.Create() .WithAdministrativeVersion(AdministrativeRating.Observer) .WithCallsign("RYR2WQ") .WithClientRating(2) .WithConnectionTime(DateTime.Now) .WithFlightPlan(null) .WithFlightSimulator(FlightSimulator.Fly) .WithGroundSpeed(20) .WithHeading(222) .WithProtocol("protocol") .WithRating(PilotRating.AirlineTransportPilot) .WithServer("server") .WithSoftwareName("sw name") .WithSoftwareVersion("1.2.3.4") .WithTransponderCode("7200") .WithVID("4321"); Pilot instance0 = builder.Build(); Pilot instance1 = builder1.Build(); // act int result0 = instance0.GetHashCode(); int result1 = instance1.GetHashCode(); // assert Assert.That(instance0, Is.Not.Null); Assert.That(instance1, Is.Not.Null); Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True); Assert.That(Equals(result0, result1), Is.False); }
public override int GetHashCode() { return(Pilot.GetHashCode()); }