Ejemplo n.º 1
0
        public void ShouldThrowExceptionCollectingQuantityArrayForInhomogenousDisplayUnits()
        {
            var inhomogenousDisplayUnits = new List <IMeasurement>()
            {
                new Measurement(1, -3, "V"), new Measurement(2, -2, "V")
            };

            Assert.That(() => inhomogenousDisplayUnits.ToQuantityArray(), Throws.Exception.TypeOf <MeasurementIncompatibilityException>());
            Assert.That(() => Measurement.ToQuantityArray(inhomogenousDisplayUnits), Throws.Exception.TypeOf <MeasurementIncompatibilityException>());
        }
Ejemplo n.º 2
0
        public void ShouldRetrieveIntrinsicQuantities()
        {
            var homogenousDisplayUnits = new List <IMeasurement>()
            {
                new Measurement(1, -3, "V"), new Measurement(2, -3, "V")
            };

            Assert.That(homogenousDisplayUnits.ToQuantityArray(), Is.EqualTo(homogenousDisplayUnits.Select(m => (double)m.Quantity).ToArray()));
            Assert.That(homogenousDisplayUnits.ToQuantityArray(), Is.EqualTo(Measurement.ToQuantityArray(homogenousDisplayUnits)));
        }