public void EqualsIsImplemented() { ElectricResistance v = ElectricResistance.FromOhms(1); Assert.True(v.Equals(ElectricResistance.FromOhms(1), ElectricResistance.FromOhms(OhmsTolerance))); Assert.False(v.Equals(ElectricResistance.Zero, ElectricResistance.FromOhms(OhmsTolerance))); }
public void EqualsIsImplemented() { ElectricResistance v = ElectricResistance.FromOhms(1); Assert.IsTrue(v.Equals(ElectricResistance.FromOhms(1))); Assert.IsFalse(v.Equals(ElectricResistance.Zero)); }
public void OpEquals() { var resistance1 = new ElectricResistance(3000, ElectricResistanceUnit.Ohm); var resistance2 = new ElectricResistance(3, ElectricResistanceUnit.Kiloohm); var resistance3 = new ElectricResistance(4, ElectricResistanceUnit.Kiloohm); (resistance1 == resistance2).ShouldBeTrue(); (resistance2 == resistance1).ShouldBeTrue(); (resistance1 == resistance3).ShouldBeFalse(); (resistance3 == resistance1).ShouldBeFalse(); resistance1.Equals(resistance2) .ShouldBeTrue(); resistance1.Equals((object)resistance2) .ShouldBeTrue(); resistance2.Equals(resistance1) .ShouldBeTrue(); resistance2.Equals((object)resistance1) .ShouldBeTrue(); }
public void EqualsReturnsFalseOnNull() { ElectricResistance ohm = ElectricResistance.FromOhms(1); Assert.False(ohm.Equals(null)); }
public void EqualsReturnsFalseOnTypeMismatch() { ElectricResistance ohm = ElectricResistance.FromOhms(1); Assert.False(ohm.Equals(new object())); }