Example #1
0
 public void DefaultPropertiesShouldBeSet()
 {
     IMeasurementService measurementService = new MeasurementServiceTest();
     var quantity1 = new Quantity(measurementService);
     Assert.IsTrue(quantity1.IsIntegral());
     Assert.IsTrue(quantity1.IsStrictlyComparableTo(new Quantity(measurementService)));
 }
Example #2
0
        public void DefaultPropertiesShouldBeSet()
        {
            IMeasurementService measurementService = new MeasurementServiceTest();
            var quantity1 = new Quantity(measurementService);

            Assert.IsTrue(quantity1.IsIntegral());
            Assert.IsTrue(quantity1.IsStrictlyComparableTo(new Quantity(measurementService)));
        }
Example #3
0
        public void CompareShouldbeCorrect()
        {
            IMeasurementService measurementService = new MeasurementServiceTest();
            var quantity1 = new Quantity(measurementService) { Magnitude = 0.1 };
            var quantity2 = new Quantity(measurementService) { Magnitude = 0.2 };
            var quantity3 = new Quantity(measurementService) { Magnitude = 0.2 };

            Assert.AreEqual(0, quantity2.CompareTo(quantity3));
            Assert.AreEqual(-1, quantity1.CompareTo(quantity2));
            Assert.AreEqual(1, quantity2.CompareTo(quantity1));
        }
Example #4
0
        public void CompareShouldbeCorrect()
        {
            IMeasurementService measurementService = new MeasurementServiceTest();
            var quantity1 = new Quantity(measurementService)
            {
                Magnitude = 0.1
            };
            var quantity2 = new Quantity(measurementService)
            {
                Magnitude = 0.2
            };
            var quantity3 = new Quantity(measurementService)
            {
                Magnitude = 0.2
            };

            Assert.AreEqual(0, quantity2.CompareTo(quantity3));
            Assert.AreEqual(-1, quantity1.CompareTo(quantity2));
            Assert.AreEqual(1, quantity2.CompareTo(quantity1));
        }