/// <summary> /// Mainly used for testing /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(UnitGroup other) { return(VolUnit.Equals(other.VolUnit) && ArUnit.Equals(other.ArUnit) && VertUnit.Equals(other.VertUnit) && HorizUnit.Equals(other.HorizUnit)); }
public void ParamlessConstructedAreaUnit_ShouldBeEqualToMetre() { // arrange var paramlessConstructedAreaUnit = new AreaUnit(); var metre = AreaUnit.SquareMetre; // act // assert metre.Equals(paramlessConstructedAreaUnit).Should().BeTrue(because: "'AreaUnit.SquareMetre' should be equal 'new AreaUnit()'"); paramlessConstructedAreaUnit.Equals(metre).Should().BeTrue(because: "'new AreaUnit()' should be equal 'AreaUnit.SquareMetre'"); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is MeasurementUnit other && ((CustomUnit == null && other.CustomUnit == null) || (CustomUnit?.Equals(other.CustomUnit) == true)) && ((AreaUnit == null && other.AreaUnit == null) || (AreaUnit?.Equals(other.AreaUnit) == true)) && ((LengthUnit == null && other.LengthUnit == null) || (LengthUnit?.Equals(other.LengthUnit) == true)) && ((VolumeUnit == null && other.VolumeUnit == null) || (VolumeUnit?.Equals(other.VolumeUnit) == true)) && ((WeightUnit == null && other.WeightUnit == null) || (WeightUnit?.Equals(other.WeightUnit) == true)) && ((GenericUnit == null && other.GenericUnit == null) || (GenericUnit?.Equals(other.GenericUnit) == true)) && ((TimeUnit == null && other.TimeUnit == null) || (TimeUnit?.Equals(other.TimeUnit) == true)) && ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true))); }