예제 #1
0
        public void TestMethodContainsNoAttribute()
        {
            IWrapperConfig configuration = WrapperConfigBuilder.Create()
                                           .TargetArchitecture(ArchitectureToLoad)
                                           .Build();

            using (var client = WrapperProxyFactory <ITestDllWithAttribute> .GetInstance(configuration))
            {
                client.MethodWithoutAttribute();
            }
        }
예제 #2
0
        public void TestLoadNonExistingFunction()
        {
            IWrapperConfig configuration = WrapperConfigBuilder.Create()
                                           .TargetArchitecture(ArchitectureToLoad)
                                           .Build();

            using (var client = WrapperProxyFactory <ITestDll> .GetInstance(configuration))
            {
                client.TestNonExistingFunction();
            }
        }
예제 #3
0
        public void TestTypeIsNotAnInterface()
        {
            IWrapperConfig configuration = WrapperConfigBuilder.Create()
                                           .TargetArchitecture(ArchitectureToLoad)
                                           .Build();

            // Test a random class that's derived from IDisposable but not an interface
            using (WrapperProxyFactory <HttpListener> .GetInstance(configuration))
            {
                // Do nothing
            }
        }
예제 #4
0
        public void TestCallMethodWithoutException()
        {
            IWrapperConfig configuration = WrapperConfigBuilder.Create()
                                           .TargetArchitecture(ArchitectureToLoad)
                                           .Build();

            // Create new Wrapper client providing the proxy interface
            // Remember to ensure a call to the Dispose()-Method!
            using (var client = WrapperProxyFactory <IUser32Dll> .GetInstance(configuration))
            {
                // Make calls - it's that simple!
                int x = client.GetSystemMetrics(0);
                int y = client.GetSystemMetrics(1);
            }
        }
예제 #5
0
        public void TestMustThrowObjectDisposedException()
        {
            IWrapperConfig configuration = WrapperConfigBuilder.Create()
                                           .TargetArchitecture(ArchitectureToLoad)
                                           .Build();

            ITestDll client;

            using (client = WrapperProxyFactory <ITestDll> .GetInstance(configuration))
            {
                // Do nothing
            }

            client.TestStdCall(0);
        }
예제 #6
0
        public void TestRefParameterHandling()
        {
            IWrapperConfig configuration = WrapperConfigBuilder.Create()
                                           .TargetArchitecture(ArchitectureToLoad)
                                           .Build();

            int parameter = 1337;

            using (var client = WrapperProxyFactory <ITestDll> .GetInstance(configuration))
            {
                client.TestVarParamHandling(ref parameter);
            }

            // Ref param should be incremented by 1
            Assert.AreEqual(1338, parameter);
        }
예제 #7
0
        public void TestPWideCharHandling()
        {
            IWrapperConfig configuration = WrapperConfigBuilder.Create()
                                           .TargetArchitecture(ArchitectureToLoad)
                                           .Build();

            string input = "Hello World";

            string result;

            using (var client = WrapperProxyFactory <ITestDll> .GetInstance(configuration))
            {
                result = client.TestPWideCharHandling(input);
            }

            Assert.AreEqual(input, result);
        }
예제 #8
0
        public void TestNormalFunc()
        {
            IWrapperConfig configuration = WrapperConfigBuilder.Create()
                                           .TargetArchitecture(ArchitectureToLoad)
                                           .Build();

            int input = 5;

            int result;

            using (var client = WrapperProxyFactory <ITestDll> .GetInstance(configuration))
            {
                result = client.TestNormalFunc(input);
            }

            Assert.AreEqual(input, result);
        }