public void GetVersion_ReturnsNotNull() { var interf = LibraryInterfaceFactory.Implement <IGetWindowsVersion>("kernel32"); var retVal = interf.GetVersion(); Assert.That(retVal, Is.Not.EqualTo(0)); }
public void GetWindowsDirectory_ReturnsWindowsDirectory() { var interf = LibraryInterfaceFactory.Implement <IGetWindowsDirectory>("kernel32"); string result = new string('\0', 1024); var winDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows); var retVal = interf.GetSystemWindowsDirectory(result, 1024); result = result.Substring(0, retVal); Assert.That(result, Is.EqualTo(winDir)); }
private static IPamInterop CreatePamInterop() { var exceptions = new List <Exception>(); foreach (var libraryLoader in GetLibraryLoaders()) { try { var library = MapAndLoad("pam", typeof(IPamInterop).Assembly, libraryLoader); if (library != null) { return(LibraryInterfaceFactory.Implement <IPamInterop>(library)); } } catch (Exception ex) { exceptions.Add(ex); } } throw new AggregateException( "Unsupported operating system, no viable library loader or library not found.", exceptions); }
static Implementation() { instance = LibraryInterfaceFactory.Implement <TInterface>(); }