public void TestPeakCANModuleLoad() { IAddonManager addons = AddonManager.Create(); var baseDir = GetBasePath(); var canFile = System.IO.Path.Combine(baseDir, "modules\\StepBro.CAN.dll"); addons.LoadAssembly(canFile, true); var pcanFile = System.IO.Path.Combine(baseDir, "modules\\StepBro.PeakCANPlugin.dll"); addons.LoadAssembly(pcanFile, true); }
public void TestLoadTestModule() { IAddonManager addons = AddonManager.Create(); var testFile = GetTestModulePath(); addons.LoadAssembly(testFile, false); var typeReference = addons.TryGetType(null, "TestModule.TestClassWithOnlyProperties"); Assert.IsNotNull(typeReference); typeReference = addons.TryGetType(null, "TestModule.SubNamespace.Deep.VeryDeep.MuchDeeper.TestClassInDeepNamespace"); Assert.IsNotNull(typeReference); typeReference = addons.TryGetType(null, "TestModule.SubNamespace.Deep.VeryDeep.MuchDeeper.TestClassInDeepNamespace.SubClass"); Assert.IsNotNull(typeReference); var usings = new UsingData[] { new UsingData(-1, addons.Lookup(null, "TestModule")) }; typeReference = addons.TryGetType(usings, "TestClassWithOnlyProperties"); Assert.IsNotNull(typeReference); Assert.AreEqual("TestClassWithOnlyProperties", typeReference.Name); typeReference = addons.TryGetType(usings, "SubNamespace.Deep.VeryDeep.MuchDeeper.TestClassInDeepNamespace.SubClass"); Assert.IsNotNull(typeReference); Assert.AreEqual("SubClass", typeReference.Name); usings = new UsingData[] { new UsingData(-1, addons.Lookup(null, "TestModule")), new UsingData(-1, addons.Lookup(null, "TestModule.SubNamespace.Deep")) }; typeReference = addons.TryGetType(usings, "VeryDeep.MuchDeeper.TestClassInDeepNamespace.SubClass"); Assert.IsNotNull(typeReference); Assert.AreEqual("SubClass", typeReference.Name); //var moduleClass = typeReference as ICodeModuleClass; //Assert.IsNotNull(moduleClass); }