protected static bool _ValuesAreEqual(Unit unit1, Unit unit2) { return unit1.Measurement == unit2.MeasurementIn(unit1.UnitType); }
public void Distance_Incrementing() { Unit<DistanceType> d1 = new Unit<DistanceType>(new Inch(), 2); Unit<DistanceType> d2 = new Unit<DistanceType>(new Millimeter(), 2); //StronglyTypedUnit<ITimeUnit> t1 = new StronglyTypedUnit<ITimeUnit>(new Inch(), 2); Unit<TimeType> t1 = new Unit<TimeType>(new Second(), 2); Unit<IUnitType> u1= new Unit<IUnitType>(new Inch(), 2); Unit<IUnitType> u2 = new Unit<IUnitType>(new Second(), 2); var result = u1 + u2; //var result2 = t1 + u1; //Static constants Distance oneFoot = 1.FromFeetToDistance(); //increments Distance twoFeet = oneFoot + oneFoot; //should be two feet (twoFeet == new Distance(new Foot(), 2)).Should().BeTrue(); Distance zeroFeet = oneFoot - oneFoot; //should be zero feet (zeroFeet == new Distance(new Foot(), 0)).Should().BeTrue(); }
protected static bool _HaveTheSameDimensions(Unit unit1, Unit unit2) { return UnitDimensions.HaveSameDimensions(unit1.UnitType.Dimensions, unit2.UnitType.Dimensions); }