public void GetDriverTypes() { Console.WriteLine("GetDriverTypes"); Console.WriteLine($"[Loader Device Types]"); foreach (var v in DriverLoader.DriverTypes) { Assert.IsNotNull(v, "Check DriverType not null"); Console.WriteLine($"Driver: {v.FullName}'"); Console.WriteLine($"IsInterface: {v.IsInterface}'"); Assert.IsFalse(v.IsInterface, "Check driver type is not interface"); Type ifType = DriverLoader.InterfaceFor(v); Console.WriteLine($"Interface: {ifType?.FullName}'"); Assert.IsNotNull(ifType, "Check InterfaceType"); Type apiType = DriverLoader.ApiTypeFor(v); Console.WriteLine($"API Type: {apiType?.FullName}'"); Assert.IsNotNull(apiType, "Validate APIType"); AssemblyName aName = v.Assembly?.GetName(); Assert.IsNotNull(aName, "Validate DriverType Assembly"); Console.WriteLine($"Assembly: {aName.FullName}'"); Console.WriteLine($"Codebase: {aName.CodeBase}'"); Console.WriteLine($"--------------------------"); Console.WriteLine(); } }
public DeviceTemplateController( SystemHelper sysHelper, UserManager <RaciUser> userManager, SignInManager <RaciUser> signInManager, ILogger logger) : base(sysHelper, userManager, signInManager, logger) { ControllerId = Guid.NewGuid().ToString(); DriverType = DriverLoader.ApiTypeFor(typeof(TDriver)).Name; }
public void DriverApiInstanceTests() { Console.WriteLine("DriverApiInstanceTests"); DriverLoaderInit(); foreach (var dt in DriverLoader.DriverTypes) { Type apiType = DriverLoader.ApiTypeFor(dt); Console.WriteLine($"Creating instance of '{apiType.FullName}'"); var iInst = DriverLoader.GetApiDriver(dt); Assert.IsNotNull(iInst, "Validate IAscomDriver reference"); var cInst = Convert.ChangeType(iInst, apiType); Assert.IsNotNull(cInst, $"Validate converted reference ({cInst})"); } }