예제 #1
0
 public void TestMethodContainsNoAttribute()
 {
     using (var client = WrapperClientFactory <ITestDllWithAttribute> .CreateWrapperClient())
     {
         client.MethodWithoutAttribute();
     }
 }
예제 #2
0
 public void TestLoadNonExistingFunction()
 {
     using (var client = WrapperClientFactory <ITestDll> .CreateWrapperClient(ArchitectureToLoad))
     {
         client.TestNonExistingFunction();
     }
 }
예제 #3
0
 public void TestTypeIsNotAnInterface()
 {
     // Test a random class that's derived from IDisposable but not an interface
     using (WrapperClientFactory <HttpListener> .CreateWrapperClient())
     {
         // Do nothing
     }
 }
예제 #4
0
        public void TestMustThrowObjectDisposedException()
        {
            ITestDll client;

            using (client = WrapperClientFactory <ITestDll> .CreateWrapperClient(ArchitectureToLoad))
            {
                // Do nothing
            }

            client.TestStdCall(0);
        }
        public void TestRefParameterHandling()
        {
            int parameter = 1337;

            using (var client = WrapperClientFactory <ITestDll> .CreateWrapperClient(ArchitectureToLoad))
            {
                client.TestVarParamHandling(ref parameter);
            }

            // Ref param should be incremented by 1
            Assert.AreEqual(1338, parameter);
        }
        public void TestPWideCharHandling()
        {
            string input = "Hello World";

            string result;

            using (var client = WrapperClientFactory <ITestDll> .CreateWrapperClient(ArchitectureToLoad))
            {
                result = client.TestPWideCharHandling(input);
            }

            Assert.AreEqual(input, result);
        }
        public void TestNormalFunc()
        {
            int input = 5;

            int result;

            using (var client = WrapperClientFactory <ITestDll> .CreateWrapperClient(ArchitectureToLoad))
            {
                result = client.TestNormalFunc(input);
            }

            Assert.AreEqual(input, result);
        }
        public void TestCallMethodWithoutException()
        {
            WrapperClientInterceptor.OverrideLibraryName = null;

            // Create new Wrapper client providing the proxy interface
            // Remember to ensure a call to the Dispose()-Method!
            using (var client = WrapperClientFactory <IUser32Dll> .CreateWrapperClient(ArchitectureToLoad))
            {
                // Make calls - it's that simple!
                int x = client.GetSystemMetrics(0);
                int y = client.GetSystemMetrics(1);
            }
        }
        public void TestMultipleRefParamsHandling()
        {
            int param1 = 1337;
            int param2 = 7777;

            using (var client = WrapperClientFactory <ITestDll> .CreateWrapperClient(ArchitectureToLoad))
            {
                client.TestMultipleVarParamsHandling(ref param1, ref param2);
            }

            // Ref param should be incremented by 1
            Assert.AreEqual(1338, param1);
            Assert.AreEqual(7778, param2);
        }