public void Execute_StringToPercentage_Double() { var obj = "10%"; var args = new LiteralScalarResolverArgs(obj); var resolver = new LiteralScalarResolver <Percentage>(args); Assert.That(resolver.Execute().Value, Is.EqualTo(0.1)); }
public void Execute_StringToDateTime_Itself() { var obj = "2017-11-13 07:05:00"; var args = new LiteralScalarResolverArgs(obj); var resolver = new LiteralScalarResolver <DateTime>(args); Assert.That(resolver.Execute(), Is.EqualTo(DateTime.Parse(obj))); }
public void Execute_DateTime_Itself() { var obj = new DateTime(2017, 11, 13, 7, 5, 0); var args = new LiteralScalarResolverArgs(obj); var resolver = new LiteralScalarResolver <DateTime>(args); Assert.That(resolver.Execute(), Is.EqualTo(obj)); }
public void Execute_StringToInt32_Itself() { string obj = "10"; var args = new LiteralScalarResolverArgs(obj); var resolver = new LiteralScalarResolver <decimal>(args); Assert.That(resolver.Execute(), Is.EqualTo(Int32.Parse(obj))); }
public void Execute_DecimalToInt_Itself() { decimal obj = new decimal(10); var args = new LiteralScalarResolverArgs(obj); var resolver = new LiteralScalarResolver <int>(args); Assert.That(resolver.Execute(), Is.EqualTo(obj)); }
public void Execute_DoubleToDecimal_Itself() { double obj = 10.0; var args = new LiteralScalarResolverArgs(obj); var resolver = new LiteralScalarResolver <decimal>(args); Assert.That(resolver.Execute(), Is.EqualTo(obj)); }
public void Execute_String_Itself() { var obj = "My name is Cédric"; var args = new LiteralScalarResolverArgs(obj); var resolver = new LiteralScalarResolver <string>(args); Assert.That(resolver.Execute(), Is.EqualTo("My name is Cédric")); }
public void Execute_StringToDecimal_Itself(string culture) { var currentCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = new CultureInfo(culture); string obj = "10.0"; var args = new LiteralScalarResolverArgs(obj); var resolver = new LiteralScalarResolver <decimal>(args); Assert.That(resolver.Execute(), Is.EqualTo(decimal.Parse(obj, NumberFormatInfo.InvariantInfo))); Thread.CurrentThread.CurrentCulture = currentCulture; }