public void TestMethodContainsNoAttribute() { IWrapperConfig configuration = WrapperConfigBuilder.Create() .TargetArchitecture(ArchitectureToLoad) .Build(); using (var client = WrapperProxyFactory <ITestDllWithAttribute> .GetInstance(configuration)) { client.MethodWithoutAttribute(); } }
public void TestLoadNonExistingFunction() { IWrapperConfig configuration = WrapperConfigBuilder.Create() .TargetArchitecture(ArchitectureToLoad) .Build(); using (var client = WrapperProxyFactory <ITestDll> .GetInstance(configuration)) { client.TestNonExistingFunction(); } }
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 } }
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); } }
public void TestMustThrowObjectDisposedException() { IWrapperConfig configuration = WrapperConfigBuilder.Create() .TargetArchitecture(ArchitectureToLoad) .Build(); ITestDll client; using (client = WrapperProxyFactory <ITestDll> .GetInstance(configuration)) { // Do nothing } client.TestStdCall(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); }
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); }
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); }