public void DeserialiseObject_KnownIronPythonTestConfigFile_CreatesObject() { LanguageSettingsSerialisation serialise = new LanguageSettingsSerialisation(); LanguageSettings ironPython = serialise.Deserialise("TestConfig\\IronPython.xml"); Assert.IsNotNull(ironPython, "Object null"); Assert.AreEqual(ironPython.Language, "IronPython", "Langauge not correct"); Assert.AreEqual(ironPython.AssembliesToLoad, "IronPython.dll;IronPython.Modules.dll", "AssembliesToLoad not correct"); Assert.AreEqual(ironPython.LanguageContextObject, "IronPython.Runtime.PythonContext", "LanguageContextObject not correct"); }
public void ExecuteStatement_ImportCLRPrintHelloWorld_NoException() { LanguageSettingsSerialisation serialise = new LanguageSettingsSerialisation(); LanguageSettings ironPython = serialise.Deserialise("TestConfig\\IronPython.xml"); EngineFactory factory = new EngineFactory(ironPython); ScriptEngine engine = factory.CreateEngine(); StringBuilder outputString = new StringBuilder(); TextWriter writer = new StringWriter(outputString); ScriptExecutor exec = new ScriptExecutor(engine, writer); exec.ExecuteStatement("import clr"); Assert.IsFalse(outputString.ToString().Contains("Error"), outputString.ToString()); Assert.IsFalse(outputString.ToString().Contains("Exception"), outputString.ToString()); }