public void EqualsObjectIsImplementedCorrectly() { var unitSystem1 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); var unitSystem2 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); var unitSystem3 = new UnitSystem(new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); Assert.True(unitSystem1.Equals((object)unitSystem2)); Assert.False(unitSystem1.Equals((object)unitSystem3)); Assert.False(unitSystem1.Equals("Some object.")); Assert.False(unitSystem1.Equals((IFormatProvider)null)); }
private void unitSystemCatalog_UnitSystemAdded(UnitSystem unitSystem) { this.listBoxUnitSystems.Items.Clear(); IList unitSystems = UnitSystemService.GetInstance().GetUnitSystemCatalog().GetList(); int idx = 0; int i = 0; IEnumerator e = unitSystems.GetEnumerator(); while (e.MoveNext()) { UnitSystem us = (UnitSystem)e.Current; this.listBoxUnitSystems.Items.Add(us); if (us.Equals(unitSystem)) { idx = i; } i++; } this.listBoxUnitSystems.SetSelected(idx, true); this.UpdateUnitSystemUI(); }