public void DoNotCompile_CallEvaluateByPassingOnlyParameters_ModifyInputScript_ElementsOfInputListShouldBeSetToZero() { var processor = new MonoCSharpProcessor(); processor.AddReferenceAssembly(typeof(MyMath.MyMath).Assembly); var parameters = new Dictionary <string, object> { { "v1", new VectorD() } }; var v = new VectorD() { 1, 2, 3, 4, 5 };; parameters["v1"] = v; processor.Evaluate(ModifyInputScript, parameters); Assert.IsTrue(v.All(e => e == 0)); v = new VectorD() { 1, 2, 3, 4, 5 }; parameters["v1"] = v; processor.Evaluate(parameters); Assert.IsTrue(v.All(e => e == 0)); }
public void CompileAndEvaluate_ModifyInputScript_ElementsOfInputListShouldBeSetToZero() { var processor = new MonoCSharpProcessor(); processor.AddReferenceAssembly(typeof(MyMath.MyMath).Assembly); var parameters = new Dictionary <string, object> { { "v1", new VectorD() } }; var script = processor.Compile(ModifyInputScript, parameters); Assert.IsTrue(script.IsCompiled); Assert.IsTrue(String.IsNullOrEmpty(processor.MessageOutput.ToString())); var v = new VectorD() { 1, 2, 3, 4, 5 };; parameters["v1"] = v; processor.Evaluate(script, parameters); Assert.IsTrue(v.All(e => e == 0)); v = new VectorD() { 1, 2, 3, 4, 5 }; parameters["v1"] = v; processor.Evaluate(parameters); Assert.IsTrue(v.All(e => e == 0)); }