Beispiel #1
0
        public void Execute_MultipleString_Permuted()
        {
            var code     = "value * 1.21";
            var provider = new NCalcTransformer <decimal>();

            provider.Initialize(code);

            Assert.That(provider.Execute(10), Is.EqualTo(12.1));
            Assert.That(provider.Execute(100), Is.EqualTo(121));
            Assert.That(provider.Execute(20), Is.EqualTo(24.2));
        }
Beispiel #2
0
        public void Execute_NumericDecimal_Multiplied()
        {
            var code     = "value * 1.21";
            var provider = new NCalcTransformer <decimal>();

            provider.Initialize(code);

            var result = provider.Execute(10m);

            Assert.That(result, Is.EqualTo(12.1));
        }
Beispiel #3
0
        public void Execute_String_Translated()
        {
            var code     = "in (value , 'Oui', 'Yes', 'Ja')";
            var provider = new NCalcTransformer <string>();

            provider.Initialize(code);

            var result = provider.Execute("Oui");

            Assert.That(result, Is.EqualTo(true));

            result = provider.Execute("Non");
            Assert.That(result, Is.EqualTo(false));
        }