Пример #1
0
        public void SourceFileSearchPath_NullPathEnvironmentVariableName()
        {
            // Todo - Investigate this to verify correctness.
            // Setup derived With basic DerivedHostTest
            ScriptRuntime runtimeEnv = CreateHostRuntime(typeof(ScriptHostBasicSubTest), "-nothing");

            // Setup Env Var to null/empty
            TestHelpers.EnvSetupTearDown EnvTest = new TestHelpers.EnvSetupTearDown("DLRPATH", "");

            // Setup host
            ScriptHostBasicSubTest host = (ScriptHostBasicSubTest)runtimeEnv.Host;

            // Setup expected paths
            List<string> expectedPaths = new List<string> {"."};

            // Verify results
            ValidateSourceFileSearchPathValues(host.GetSourceFileSearchPath(), expectedPaths);
        }
Пример #2
0
        public void ResolveSourceFileName_LookForFilePysicallyAddFileAndDLRPATH()
        {
            // Adjust DLRPATH and place a file in this directory
            // After looking at the source code I see that I need to leave off the file extension.
            string fileExt = ".py";
            string tmpFileName = TestHelpers.CreateTempSourceFile(_codeSnippets[CodeType.OneLineAssignmentStatement],
                                                                  fileExt);
            string FileNameInDLRPath = Path.GetFileName(tmpFileName).Replace(fileExt, "");
            string testDLRPath = Path.GetDirectoryName(tmpFileName);

            TestHelpers.EnvSetupTearDown EnvTest = new TestHelpers.EnvSetupTearDown("DLRPATH", testDLRPath);

            // This could possble enable the host to be aware of other search path
            ScriptRuntime newRuntimeEnv = CreateHostRuntime(typeof(ScriptHostBasicSubTest), "-nothing");
            ScriptHostBasicSubTest host = (ScriptHostBasicSubTest)newRuntimeEnv.Host;

            // Verify search result
            ValidateResolveSourceFileNameSearchResult(host, FileNameInDLRPath,
                                                      testDLRPath + "\\" + FileNameInDLRPath + fileExt);
        }