public void TryGetUnit_NotUniqueUnit_GetsFirstRegistered() { var unitProvider = new UnitProvider(CultureInfo.InvariantCulture); unitProvider.RegisterUnit(Length.Metre, "m"); unitProvider.RegisterUnit(TypographicLength.Metre, "m"); Length unit; Assert.IsTrue(unitProvider.TryGetUnit("m", out unit)); Assert.AreEqual(Length.Metre, unit); }
public void TryGetUnit_GenericOutputAndNotUniqueUnit_GetsFirstRegistered() { var unitProvider = new UnitProvider(CultureInfo.InvariantCulture); unitProvider.RegisterUnit(Length.Metre, "m"); unitProvider.RegisterUnit(TypographicLength.Metre, "m"); IQuantity unit; Assert.IsTrue(unitProvider.TryGetUnit(typeof(Length), "m", out unit)); Assert.AreEqual(Length.Metre, unit); }