public void TryGetDisplayUnit_UnregisteredUnit() { var unitProvider = new UnitProvider(CultureInfo.InvariantCulture); unitProvider.RegisterUnit(TypographicLength.Metre, "m"); unitProvider.TrySetDisplayUnit <TypographicLength>("m"); Length unit; string symbol; Assert.IsFalse(unitProvider.TryGetDisplayUnit(out unit, out symbol)); }
public void TryGetDisplayUnit_RegisteredUnit() { var unitProvider = new UnitProvider(CultureInfo.InvariantCulture); unitProvider.RegisterUnit(Length.Metre, "m"); unitProvider.TrySetDisplayUnit <Length>("m"); Length unit; string symbol; Assert.IsTrue(unitProvider.TryGetDisplayUnit(out unit, out symbol)); Assert.AreEqual(Length.Metre, unit); Assert.AreEqual("m", symbol); }
public void TryGetDisplayUnit_UnregisteredUnit() { var unitProvider = new UnitProvider(CultureInfo.InvariantCulture); unitProvider.RegisterUnit(TypographicLength.Metre, "m"); unitProvider.TrySetDisplayUnit<TypographicLength>("m"); Length unit; string symbol; Assert.IsFalse(unitProvider.TryGetDisplayUnit(out unit, out symbol)); }
public void TryGetDisplayUnit_RegisteredUnit() { var unitProvider = new UnitProvider(CultureInfo.InvariantCulture); unitProvider.RegisterUnit(Length.Metre, "m"); unitProvider.TrySetDisplayUnit<Length>("m"); Length unit; string symbol; Assert.IsTrue(unitProvider.TryGetDisplayUnit(out unit, out symbol)); Assert.AreEqual(Length.Metre, unit); Assert.AreEqual("m", symbol); }