public void EqualsIsImplemented() { SpecificEnergy v = SpecificEnergy.FromJoulesPerKilogram(1); Assert.True(v.Equals(SpecificEnergy.FromJoulesPerKilogram(1), SpecificEnergy.FromJoulesPerKilogram(JoulesPerKilogramTolerance))); Assert.False(v.Equals(SpecificEnergy.Zero, SpecificEnergy.FromJoulesPerKilogram(JoulesPerKilogramTolerance))); }
public void EqualsIsImplemented() { SpecificEnergy v = SpecificEnergy.FromJoulesPerKilogram(1); Assert.IsTrue(v.Equals(SpecificEnergy.FromJoulesPerKilogram(1))); Assert.IsFalse(v.Equals(SpecificEnergy.Zero)); }
public void ZeroUnitsSpecificEnergy_ShouldBeEqualToZeroJoulesPerKilogram() { // arrange var zeroJoulesPerKilogramSpecificEnergy = new SpecificEnergy(Constants.Zero); var zeroUnitsSpecificEnergy = new SpecificEnergy(Constants.Zero, CreateUnitOtherThan(SpecificEnergyUnit.JoulePerKilogram)); // act // assert zeroJoulesPerKilogramSpecificEnergy.Equals(zeroUnitsSpecificEnergy).Should().BeTrue(because: "'new SpecificEnergy(Constants.Zero)' should be equal 'new SpecificEnergy(Constants.Zero, SomeUnit)'"); zeroUnitsSpecificEnergy.Equals(zeroJoulesPerKilogramSpecificEnergy).Should().BeTrue(because: "'new SpecificEnergy(Constants.Zero, SomeUnit)' should be equal 'new SpecificEnergy(Constants.Zero)'"); }
public void SpecificEnergyCreateUsingParamlessConstructor_ShouldBeEqualToZeroJoulesPerKilogram() { // arrange var zeroJoulesPerKilogramSpecificEnergy = new SpecificEnergy(Constants.Zero); var paramlessConstructedSpecificEnergy = new SpecificEnergy(); // act // assert zeroJoulesPerKilogramSpecificEnergy.Equals(paramlessConstructedSpecificEnergy).Should().BeTrue(because: "'new SpecificEnergy(Constants.Zero)' should be equal 'new SpecificEnergy()'"); paramlessConstructedSpecificEnergy.Equals(zeroJoulesPerKilogramSpecificEnergy).Should().BeTrue(because: "'new SpecificEnergy()' should be equal 'new SpecificEnergy(Constants.Zero)'"); }
public void DefaultSpecificEnergy_ShouldBeEqualToZeroJoulesPerKilogram() { // arrange var defaultSpecificEnergy = default(SpecificEnergy); var zeroJoulesPerKilogramSpecificEnergy = new SpecificEnergy(Constants.Zero); // act // assert zeroJoulesPerKilogramSpecificEnergy.Equals(defaultSpecificEnergy).Should().BeTrue(because: "'new SpecificEnergy(Constants.Zero)' should be equal 'default(SpecificEnergy)'"); defaultSpecificEnergy.Equals(zeroJoulesPerKilogramSpecificEnergy).Should().BeTrue(because: "'default(SpecificEnergy)' should be equal 'new SpecificEnergy(Constants.Zero)'"); }
public void SpecificEnergysConvertedToDifferentUnitsEqualInJoulesPerKilogram_ShouldBeEqual() { // arrange var specificEnergy1 = new SpecificEnergy(Fixture.Create <number>()).Convert(CreateUnitOtherThan(SpecificEnergyUnit.JoulePerKilogram)); var specificEnergy2 = new SpecificEnergy(specificEnergy1.JoulesPerKilogram).Convert(CreateUnitOtherThan(specificEnergy1.Unit)); // act bool equalsResult = specificEnergy1.Equals(specificEnergy2); // assert equalsResult.Should().BeTrue(); }
public void EqualsReturnsFalseOnNull() { SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); Assert.False(jouleperkilogram.Equals(null)); }
public void EqualsReturnsFalseOnTypeMismatch() { SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); Assert.False(jouleperkilogram.Equals(new object())); }