public void AddSameUsedNamespaceTwice_Success()
 {
     using (var expression = new CSharpScript())
     {
         expression.AddUsedNamespace("System.Collections");
         expression.AddUsedNamespace("System.Collections");
         expression.GenerateCode();
         expression.Compile();
         Assert.True(true); // If we go here with no exception, we are good
     }
 }
Пример #2
0
        /// <summary>
        /// Loads the experiment.
        /// </summary>
        public static void RunExperiment(Experiment experiment)
        {
            IScript script = null;

            switch (experiment.Engine)
            {
            case ScriptingEngines.Python:
                script = new PythonScript();
                break;

            case ScriptingEngines.CSharp:
                script = new CSharpScript();
                break;

            default:
                throw new NotImplementedException("The scripting language " + experiment.Engine + "has not yet been implemented.");
            }

            var path = Path.Combine(experiment.Name, experiment.Script);

            script.Load(path);
            script.Compile();
            script.Start();
        }
 public void ExpressionWithSyntaxError_Failure()
 {
     using (var expression = new CSharpScript("1 + obj.int_Field"))
         expression.Compile();
 }