コード例 #1
0
ファイル: LoadLibraryTest.cs プロジェクト: tjaskula/rdotnet
 public void TestLoadWindows()
 {
     // Test, if possible, loading 32 bits R.dll from a 64 bits process.
     // I do not really like tests to be platform-dependent, but this is pragmatically unavoidable.
     if (Environment.OSVersion.Platform != PlatformID.Win32NT)
         return;
     string rDllPath = "";
     try
     {
         rDllPath = NativeUtility.FindRPathFromRegistry();
     }
     catch (ApplicationException) // registry keys not found - bail out
     {
         return;
     }
     if (Environment.Is64BitProcess)
     {
         if (!rDllPath.Contains("x64")) // Odd, but not what we are testing here.
             return;
         rDllPath = rDllPath.Replace("x64", "i386");
         var rDllFullFilePath = Path.Combine(rDllPath, NativeUtility.GetRLibraryFileName());
         if (!File.Exists(rDllFullFilePath))
             return;
         Assert.Throws(typeof(Exception), () => { var lib = new MockLoadLib(rDllFullFilePath); });
     }
 }
コード例 #2
0
        public void TestLoadWindows()
        {
            // Test, if possible, loading 32 bits R.dll from a 64 bits process.
            // I do not really like tests to be platform-dependent, but this is pragmatically unavoidable.
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return;
            }
            string rDllPath = "";

            try
            {
                rDllPath = new NativeUtility().FindRPathFromRegistry();
            }
            catch (ApplicationException) // registry keys not found - bail out
            {
                return;
            }
            if (Environment.Is64BitProcess)
            {
                if (!rDllPath.Contains("x64")) // Odd, but not what we are testing here.
                {
                    return;
                }
                rDllPath = rDllPath.Replace("x64", "i386");
                var rDllFullFilePath = Path.Combine(rDllPath, NativeUtility.GetRLibraryFileName());
                if (!File.Exists(rDllFullFilePath))
                {
                    return;
                }
                Assert.Throws <ArgumentException>(() => { var lib = new MockLoadLib(rDllFullFilePath); });
            }
        }
コード例 #3
0
 public void TestLoadUnmanagedDllNullRef()
 {
     Assert.Throws <ArgumentNullException>(
         () => {
         var lib = new MockLoadLib(null);
     });
 }
コード例 #4
0
 public void TestLoadUnmanagedDllWrongShortName()
 {
     // Note: this does not pass as of 2017-08.
     // Kept as is until dynamic-interop changes the exception type to ArgumentException.
     Assert.Throws <ArgumentException>(
         () => {
         var lib = new MockLoadLib("SomeVeryUnlikelyName.dll");
     });
 }
コード例 #5
0
 public void TestLoadUnmanagedDllEmptyString()
 {
     Assert.Throws <ArgumentException>(
         () => {
         var lib = new MockLoadLib("");
     },
         "The name of the library to load is an empty string"
         );
 }
コード例 #6
0
 public void TestLoadUnmanagedDllWrongShortName()
 {
     var lib = new MockLoadLib("SomeVeryUnlikelyName.dll");
 }
コード例 #7
0
 public void TestLoadUnmanagedDllEmptyString()
 {
     var lib = new MockLoadLib("");
 }
コード例 #8
0
 public void TestLoadUnmanagedDllNullRef()
 {
     var lib = new MockLoadLib(null);
 }
コード例 #9
0
ファイル: LoadLibraryTest.cs プロジェクト: tjaskula/rdotnet
 public void TestLoadUnmanagedDllWrongShortName()
 {
     var lib = new MockLoadLib("SomeVeryUnlikelyName.dll");
 }
コード例 #10
0
ファイル: LoadLibraryTest.cs プロジェクト: tjaskula/rdotnet
 public void TestLoadUnmanagedDllEmptyString()
 {
     var lib = new MockLoadLib("");
 }
コード例 #11
0
ファイル: LoadLibraryTest.cs プロジェクト: tjaskula/rdotnet
 public void TestLoadUnmanagedDllNullRef()
 {
     var lib = new MockLoadLib(null);
 }