Exemplo n.º 1
0
        public void PrefixFactor_Then_ResultShouldBe1()
        {
            var testee = new Unit("m");

            var result = testee.PrefixFactor;

            result.Should().Be(1);
        }
Exemplo n.º 2
0
        public void GetPrefixedUnit_Then_ResultPrefixFactorShouldBeExpectedPrefixFactor(double expectedPrefixFactor)
        {
            var testee = new Unit("m");

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

            result.PrefixFactor.Should().Be(expectedPrefixFactor);
        }
Exemplo n.º 3
0
        public void Notation_Then_ResultShouldBeExpected()
        {
            const string ExpectedNotation = "g";
            var testee = new Unit(ExpectedNotation);

            var result = testee.Notation;

            result.Should().Be(ExpectedNotation);
        }
Exemplo n.º 4
0
        public void GetNotationWithoutPrefix_ThenResultShouldBeExpectedNotation()
        {
            const string ExpectedNotation = "m";
            var testee = new Unit(Prefixes.Kilo, ExpectedNotation);

            var result = testee.GetNotationWithoutPrefix();

            result.Should().Be(ExpectedNotation);
        }
Exemplo n.º 5
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;
        }