Наследование: HostingTest.HAPITestBase
Пример #1
0
        public void CreateScope_GetEngineWithNoLanguage()
        {
            var runtime = ScriptRuntimeTest.CreateRuntime();
            var scope   = runtime.CreateScope();

            Assert.AreNotEqual(scope.Engine, null);
        }
        public void GetRegisteredExtensions_LangWithNoExt()
        {
            ScriptRuntime runtime = ScriptRuntimeTest.CreatePythonOnlyRuntime(new string[] { "py" }, new string[] { });
            ScriptEngine  engine  = runtime.GetEngine("py");

            Assert.IsTrue(0 == engine.Setup.FileExtensions.Count);
        }
        public void GetRegisteredIdentifiers_LangWithNoIDs_Test()
        {
            ScriptRuntime runtime = ScriptRuntimeTest.CreatePythonOnlyRuntime(new string[] { }, new string[] { ".py" });
            ScriptEngine  engine  = runtime.GetEngineByFileExtension("py");

            Assert.IsTrue(0 == engine.Setup.Names.Count);
        }
Пример #4
0
        public void Setup_EmptyDisplayName()
        {
            var setup = ScriptRuntimeTest.CreateSetup();

            setup.LanguageSetups[0].DisplayName = "";
            var runtime = new ScriptRuntime(setup);

            Assert.AreEqual("", runtime.Setup.LanguageSetups[0].DisplayName);
        }
Пример #5
0
        public void Setup_InvalidTypeName()
        {
            // Dev10 bug 502234
            var setup = ScriptRuntimeTest.CreateSetup();

            setup.LanguageSetups[0].TypeName = setup.LanguageSetups[0].TypeName.Replace("PythonContext", "PythonBuffer");
            var runtime = new ScriptRuntime(setup);

            runtime.GetEngine("py");
        }
Пример #6
0
        [Ignore]//Unregistering a language is not supported. So this test may have to be removed
        public void GetEngineByFileExtension_UnRegisteredExtensions()
        {
            ScriptRuntime runtime = ScriptRuntimeTest.CreatePythonOnlyRuntime(new[] { "py" }, new[] { ".py" });

            Assert.IsTrue(1 == runtime.Setup.LanguageSetups.Count);
            // @TODO - How do we un-register a language? what
            //         are the expected results.
            Assert.Inconclusive(
                "How do we un-register a language? what are the expected results");
        }
Пример #7
0
        public void Create_PassUnloadedAppDomain()
        {
            AppDomain otherAD = TestHelpers.CreateAppDomain("SecondAppDomain");

            //this call is not really needed, but let's have it and use it to check if the domain was
            //created properly and we were able to execute a create call successfully
            ScriptRuntime runtime1 = ScriptRuntimeTest.CreateRuntime(otherAD);

            AppDomain.Unload(otherAD);

            // This should throw
            ScriptRuntime runtime2 = ScriptRuntimeTest.CreateRuntime(otherAD);
        }
Пример #8
0
        public void GetVariableAsHandle_RemoteEngineRemoteValue()
        {
            ScriptRuntime env    = ScriptRuntimeTest.CreateRuntime(TestHelpers.CreateAppDomain("new domain"));
            ScriptEngine  engine = env.GetEngine("py");

            ScriptScope  scope = engine.CreateScope();
            ScriptSource code  = engine.CreateScriptSourceFromString("two=1+1", SourceCodeKind.Statements);

            code.Execute(scope);

            ObjectHandle obj = scope.GetVariableHandle("two");

            int two = (int)obj.Unwrap();

            Assert.AreEqual(two, 2);
        }
Пример #9
0
        public void Configuration_OneRegisteredLanguageName()
        {
            ScriptRuntime runtime = ScriptRuntimeTest.CreatePythonOnlyRuntime(new[] { "py" }, new[] { ".py" });

            Assert.IsTrue(1 == runtime.Setup.LanguageSetups[0].Names.Count);
        }
Пример #10
0
 public void Create_NullAppDomain()
 {
     ScriptRuntimeTest.CreateRuntime(null);
 }