public void PrefixFactor_Then_ResultShouldBe1() { var testee = new Unit("m"); var result = testee.PrefixFactor; result.Should().Be(1); }
public void GetPrefixedUnit_Then_ResultPrefixFactorShouldBeExpectedPrefixFactor(double expectedPrefixFactor) { var testee = new Unit("m"); var result = testee.GetPrefixedUnit(Prefixes.Kilo); result.PrefixFactor.Should().Be(expectedPrefixFactor); }
public void Notation_Then_ResultShouldBeExpected() { const string ExpectedNotation = "g"; var testee = new Unit(ExpectedNotation); var result = testee.Notation; result.Should().Be(ExpectedNotation); }
public void GetNotationWithoutPrefix_ThenResultShouldBeExpectedNotation() { const string ExpectedNotation = "m"; var testee = new Unit(Prefixes.Kilo, ExpectedNotation); var result = testee.GetNotationWithoutPrefix(); result.Should().Be(ExpectedNotation); }
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; }