Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/BreakWater.cs =================================================================== diff -u -rfd7cb4da4164284049a3627b1d85f92e722d1814 -rd67d84b0725d8e7192f1b8e2649eab0a5b1dcb69 --- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/BreakWater.cs (.../BreakWater.cs) (revision fd7cb4da4164284049a3627b1d85f92e722d1814) +++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/BreakWater.cs (.../BreakWater.cs) (revision d67d84b0725d8e7192f1b8e2649eab0a5b1dcb69) @@ -81,11 +81,7 @@ public override int GetHashCode() { - unchecked - { - int hashCode = height.GetHashCode(); - return (hashCode * 397) ^ (int) Type; - } + return 0; } public object Clone() Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfile1D.cs =================================================================== diff -u -r228ee54da56eded41bf81bba88cf54371f11d2bb -rd67d84b0725d8e7192f1b8e2649eab0a5b1dcb69 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfile1D.cs (.../MacroStabilityInwardsSoilProfile1D.cs) (revision 228ee54da56eded41bf81bba88cf54371f11d2bb) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfile1D.cs (.../MacroStabilityInwardsSoilProfile1D.cs) (revision d67d84b0725d8e7192f1b8e2649eab0a5b1dcb69) @@ -148,10 +148,6 @@ { int hashCode = Bottom.GetHashCode(); hashCode = (hashCode * 397) ^ Name.GetHashCode(); - foreach (MacroStabilityInwardsSoilLayer1D layer in layers) - { - hashCode = (hashCode * 397) ^ layer.GetHashCode(); - } return hashCode; } } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfile2D.cs =================================================================== diff -u -r228ee54da56eded41bf81bba88cf54371f11d2bb -rd67d84b0725d8e7192f1b8e2649eab0a5b1dcb69 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfile2D.cs (.../MacroStabilityInwardsSoilProfile2D.cs) (revision 228ee54da56eded41bf81bba88cf54371f11d2bb) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfile2D.cs (.../MacroStabilityInwardsSoilProfile2D.cs) (revision d67d84b0725d8e7192f1b8e2649eab0a5b1dcb69) @@ -94,6 +94,7 @@ { throw new ArgumentNullException(nameof(value)); } + name = value; } } @@ -109,14 +110,17 @@ { return false; } + if (ReferenceEquals(this, obj)) { return true; } + if (obj.GetType() != GetType()) { return false; } + return Equals((MacroStabilityInwardsSoilProfile2D) obj); } @@ -125,15 +129,7 @@ unchecked { int hashCode = Name.GetHashCode(); - foreach (MacroStabilityInwardsSoilLayer2D layer in layers) - { - hashCode = (hashCode * 397) ^ layer.GetHashCode(); - } - foreach (MacroStabilityInwardsPreconsolidationStress stress in PreconsolidationStresses) - { - hashCode = (hashCode * 397) ^ stress.GetHashCode(); - } - return hashCode; + return PreconsolidationStresses.Aggregate(hashCode, (currentHashCode, stress) => (currentHashCode * 397) ^ stress.GetHashCode()); } } @@ -156,6 +152,7 @@ { throw new ArgumentNullException(nameof(collection), string.Format(Resources.Error_Cannot_Construct_MacroStabilityInwardsSoilProfile_Without_Layers)); } + if (!collection.Any()) { throw new ArgumentException(Resources.Error_Cannot_Construct_MacroStabilityInwardsSoilProfile_Without_Layers); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayerData.cs =================================================================== diff -u -r228ee54da56eded41bf81bba88cf54371f11d2bb -rd67d84b0725d8e7192f1b8e2649eab0a5b1dcb69 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayerData.cs (.../MacroStabilityInwardsSoilLayerData.cs) (revision 228ee54da56eded41bf81bba88cf54371f11d2bb) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayerData.cs (.../MacroStabilityInwardsSoilLayerData.cs) (revision d67d84b0725d8e7192f1b8e2649eab0a5b1dcb69) @@ -268,12 +268,7 @@ { unchecked { - int hashCode = StringComparer.InvariantCulture.GetHashCode(materialName); - hashCode = (hashCode * 397) ^ IsAquifer.GetHashCode(); - hashCode = (hashCode * 397) ^ Color.GetHashCode(); - hashCode = (hashCode * 397) ^ UsePop.GetHashCode(); - hashCode = (hashCode * 397) ^ ShearStrengthModel.GetHashCode(); - hashCode = (hashCode * 397) ^ AbovePhreaticLevel.GetHashCode(); + int hashCode = AbovePhreaticLevel.GetHashCode(); hashCode = (hashCode * 397) ^ BelowPhreaticLevel.GetHashCode(); hashCode = (hashCode * 397) ^ Cohesion.GetHashCode(); hashCode = (hashCode * 397) ^ FrictionAngle.GetHashCode(); Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs =================================================================== diff -u -r686466dda6406ee2c7fb1f33faa60494878b1fc8 -rd67d84b0725d8e7192f1b8e2649eab0a5b1dcb69 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs (.../PipingSoilLayer.cs) (revision 686466dda6406ee2c7fb1f33faa60494878b1fc8) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs (.../PipingSoilLayer.cs) (revision d67d84b0725d8e7192f1b8e2649eab0a5b1dcb69) @@ -173,13 +173,10 @@ { unchecked { - int hashCode = materialName?.GetHashCode() ?? 0; - hashCode = (hashCode * 397) ^ Top.GetHashCode(); - hashCode = (hashCode * 397) ^ IsAquifer.GetHashCode(); + int hashCode = Top.GetHashCode(); hashCode = (hashCode * 397) ^ BelowPhreaticLevel.GetHashCode(); hashCode = (hashCode * 397) ^ DiameterD70.GetHashCode(); hashCode = (hashCode * 397) ^ Permeability.GetHashCode(); - hashCode = (hashCode * 397) ^ Color.GetHashCode(); return hashCode; } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs =================================================================== diff -u -re318f8ad1ae9ff8fabdb362d27e3db320af91ac0 -rd67d84b0725d8e7192f1b8e2649eab0a5b1dcb69 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision e318f8ad1ae9ff8fabdb362d27e3db320af91ac0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision d67d84b0725d8e7192f1b8e2649eab0a5b1dcb69) @@ -144,10 +144,6 @@ int hashCode = Bottom.GetHashCode(); hashCode = (hashCode * 397) ^ Name.GetHashCode(); hashCode = (hashCode * 397) ^ (int) SoilProfileSourceType; - foreach (PipingSoilLayer layer in layers) - { - hashCode = (hashCode * 397) ^ layer.GetHashCode(); - } return hashCode; } }