Evaluation engine with code injection for .Net

Clone this repo:
  1. d7ec1e5 Adds failing unit test. by Dan Pristupov · 8 years ago develop
  2. 68196e5 Updates nuget spec by Dan Pristupov · 8 years ago
  3. f654f19 Adds missed nuget spec by Dan Pristupov · 8 years ago
  4. 041324f Merge branch 'feature/RuntimeProperty' into develop by DanPristupov · 8 years ago
  5. 757ea3e Fixes autoproperties. GeneralTest_RuntimeAutoProperties pass. by Dan Pristupov · 8 years ago feature/RuntimeProperty

##Evalution

Evalution is an evaluation library which allows to inject math expressions in a property during runtime.

Evalution is not an expression interpretator. It's a JIT-compiler. It parses an expression, builds abstract syntax tree and then generates the IL code. The generated code is as fast as a native .Net code.

Currently Evalution supports Int32 and Double types. TimeSpan/DateTime and string operations will be implemented soon.

Evalution is written in F# (only because I want to learn the language :)).

Example:

    [Test]
    public void GeneralTest_Double()
    {
        var classBuilder = new ClassBuilder<ClassDouble>()
            .Setup(x => x.ValueWithExpression,  "2.0 + 2.0 * 2.5")
            .Setup(x => x.DependentValue1,      "Value1 * 2.0")
            .Setup(x => x.DependentValue2,      "DependentValue1 * 2.0");
        var target = classBuilder.BuildObject();

        target.Value1 = 1.5;
        Assert.AreEqual(7.0, target.ValueWithExpression);   // "2.0 + 2.0 * 2.5"
        Assert.AreEqual(3.0, target.DependentValue1);       // "Value1 * 2.0"
        Assert.AreEqual(6.0, target.DependentValue2);       // "DependentValue1 * 2.0"
    }

There's also a non-generic API:

    [Test]
    public void GeneralTest_NonGeneric()
    {
        var classBuilder = new ClassBuilder(typeof(ClassInt32))
            .Setup("ValueWithExpression",   "2 + 2 * 2")
            .Setup("DependentValue1",       "Value1 * 2")
            .Setup("DependentValue2",       "DependentValue1 * 2");
        var target = (ClassInt32)classBuilder.BuildObject();
        
        target.Value1 = 4;
        Assert.AreEqual(6,  target.ValueWithExpression);    // "2+2*2"
        Assert.AreEqual(8,  target.DependentValue1);        // "Value1*2"
        Assert.AreEqual(16, target.DependentValue2);        // "DependentValue1*2"
    }