Example #1
0
        public void EqualsIsImplemented()
        {
            Density v = Density.FromKilogramPerCubicMeter(1);

            Assert.IsTrue(v.Equals(Density.FromKilogramPerCubicMeter(1)));
            Assert.IsFalse(v.Equals(Density.Zero));
        }
Example #2
0
        public void CompareToThrowsOnNull()
        {
            Density kilogrampercubicmeter = Density.FromKilogramPerCubicMeter(1);

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            kilogrampercubicmeter.CompareTo(null);
        }
Example #3
0
        public void CompareToThrowsOnTypeMismatch()
        {
            Density kilogrampercubicmeter = Density.FromKilogramPerCubicMeter(1);

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            kilogrampercubicmeter.CompareTo(new object());
        }
Example #4
0
        public void CompareToIsImplemented()
        {
            Density kilogrampercubicmeter = Density.FromKilogramPerCubicMeter(1);

            Assert.AreEqual(0, kilogrampercubicmeter.CompareTo(kilogrampercubicmeter));
            Assert.Greater(kilogrampercubicmeter.CompareTo(Density.Zero), 0);
            Assert.Less(Density.Zero.CompareTo(kilogrampercubicmeter), 0);
        }
Example #5
0
        public void ArithmeticOperators()
        {
            Density v = Density.FromKilogramPerCubicMeter(1);

            Assert.AreEqual(-1, -v.KilogramPerCubicMeter, KilogramPerCubicMeterTolerance);
            Assert.AreEqual(2, (Density.FromKilogramPerCubicMeter(3) - v).KilogramPerCubicMeter, KilogramPerCubicMeterTolerance);
            Assert.AreEqual(2, (v + v).KilogramPerCubicMeter, KilogramPerCubicMeterTolerance);
            Assert.AreEqual(10, (v * 10).KilogramPerCubicMeter, KilogramPerCubicMeterTolerance);
            Assert.AreEqual(10, (10 * v).KilogramPerCubicMeter, KilogramPerCubicMeterTolerance);
            Assert.AreEqual(2, (Density.FromKilogramPerCubicMeter(10) / 5).KilogramPerCubicMeter, KilogramPerCubicMeterTolerance);
            Assert.AreEqual(2, Density.FromKilogramPerCubicMeter(10) / Density.FromKilogramPerCubicMeter(5), KilogramPerCubicMeterTolerance);
        }
Example #6
0
        public void EqualityOperators()
        {
            Density a = Density.FromKilogramPerCubicMeter(1);
            Density b = Density.FromKilogramPerCubicMeter(2);

// ReSharper disable EqualExpressionComparison
            Assert.True(a == a);
            Assert.True(a != b);

            Assert.False(a == b);
            Assert.False(a != a);
// ReSharper restore EqualExpressionComparison
        }
Example #7
0
        public void ComparisonOperators()
        {
            Density oneKilogramPerCubicMeter = Density.FromKilogramPerCubicMeter(1);
            Density twoKilogramPerCubicMeter = Density.FromKilogramPerCubicMeter(2);

            Assert.True(oneKilogramPerCubicMeter < twoKilogramPerCubicMeter);
            Assert.True(oneKilogramPerCubicMeter <= twoKilogramPerCubicMeter);
            Assert.True(twoKilogramPerCubicMeter > oneKilogramPerCubicMeter);
            Assert.True(twoKilogramPerCubicMeter >= oneKilogramPerCubicMeter);

            Assert.False(oneKilogramPerCubicMeter > twoKilogramPerCubicMeter);
            Assert.False(oneKilogramPerCubicMeter >= twoKilogramPerCubicMeter);
            Assert.False(twoKilogramPerCubicMeter < oneKilogramPerCubicMeter);
            Assert.False(twoKilogramPerCubicMeter <= oneKilogramPerCubicMeter);
        }
Example #8
0
        public void ConversionRoundTrip()
        {
            Density kilogrampercubicmeter = Density.FromKilogramPerCubicMeter(1);

            Assert.AreEqual(1, Density.FromKilogramPerCubicMeter(kilogrampercubicmeter.KilogramPerCubicMeter).KilogramPerCubicMeter, KilogramPerCubicMeterTolerance);
        }
Example #9
0
        public void As()
        {
            var kilogrampercubicmeter = Density.FromKilogramPerCubicMeter(1);

            Assert.AreEqual(KilogramPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilogramPerCubicMeter), KilogramPerCubicMeterTolerance);
        }
Example #10
0
        public void KilogramPerCubicMeterToDensityUnits()
        {
            Density kilogrampercubicmeter = Density.FromKilogramPerCubicMeter(1);

            Assert.AreEqual(KilogramPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilogramPerCubicMeter, KilogramPerCubicMeterTolerance);
        }
Example #11
0
        public void EqualsReturnsFalseOnNull()
        {
            Density kilogrampercubicmeter = Density.FromKilogramPerCubicMeter(1);

            Assert.IsFalse(kilogrampercubicmeter.Equals(null));
        }
Example #12
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            Density kilogrampercubicmeter = Density.FromKilogramPerCubicMeter(1);

            Assert.IsFalse(kilogrampercubicmeter.Equals(new object()));
        }