Ejemplo n.º 1
0
        public void GetPrefixedUnit_Then_ResultPrefixFactorShouldBeExpectedPrefixFactor(double expectedPrefixFactor)
        {
            var testee = new Unit("m");

            var result = testee.GetPrefixedUnit(Prefixes.Kilo);

            result.PrefixFactor.Should().Be(expectedPrefixFactor);
        }
Ejemplo n.º 2
0
        public void GetPrefixedUnit_Then_ResultNotationShouldBeExpectedNotation()
        {
            const string ExpectedNotation = "km";
            var testee = new Unit("m");

            var result = testee.GetPrefixedUnit(Prefixes.Kilo);

            result.Notation.Should().Be(ExpectedNotation);
        }
        private static IUnit GetUnit(string lhsUnit)
        {
            var unit = new Unit(lhsUnit.Cast<char>().Last().ToString());
            if (lhsUnit.Length == 2)
            {
                var notation = lhsUnit[0].ToString();
                return unit.GetPrefixedUnit(new FactoredPrefix(notation, 1000, notation));
            }

            return unit;
        }