public void TestLoadAndInterfaceWithConstructor() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test"); var cp = new object[] {}; CrossDomainCompiler.Call(@"test", typeof(SimpleInterface), "ImplWithConstructor", "CallMe", ref cp); }
public void TestLoadAndCallMethodWithArgumentImpl() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test"); var cp = new object[] {}; var mp = new object[] { "Hellow world!" }; CrossDomainCompiler.Call(@"test", typeof(MethodWithArgument), "MethodWithArgumentImpl", "CallMe", ref cp, ref mp); }
public void TestLoadWatcher() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test"); //watcher while (true) { Thread.Sleep(1000); } }
public void TestLoadAndCallMethodWithArgumentModifyImpl() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test"); var cp = new object[] {}; var mp = new object[] { "Hellow world!" }; CrossDomainCompiler.Call(@"test", typeof(MethodWithArgumentChanged), "MethodWithArgumentChangedImpl", "CallMe", ref cp, ref mp); StringAssert.AreEqualIgnoringCase("Hello Unit.", (string)mp[0]); }
public void TestLoadAndCallPerf() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test"); var start = DateTime.Now; const int upper = 100; for (var i = 0; i < upper; i++) { CrossDomainCompiler.Call(@"test", typeof(SimpleInterface), "ImplWithConstructor", "CallMe"); } var end = DateTime.Now; var tpercall = ((end.Ticks - start.Ticks) / upper / 10000); Assert.Less(tpercall, 20); }
public void Initialize() { //var catalog = new AssemblyCatalog(typeof(CxxAdapterManager).Assembly); var catalog = new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory, "*.*"); CompositionContainer cc = new CompositionContainer(catalog); cc.ComposeParts(this); _adapterMap = new Dictionary <uint, ISensorAdapter>(); foreach (Lazy <ISensorAdapter, ISensorProtocol> sa in _adapters) { _adapterMap[sa.Metadata.Protocol] = sa.Value; } ReLoad(); try { CrossDomainCompiler.LoadScript(string.Format("{0}\\{1}", _adapterPath, AdapterReferences), _adapterPath); } catch (Exception ex) { Log.ErrorFormat("脚本编译错误{0}", ex.Message); } }
public void TestLoadAndCall() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test"); CrossDomainCompiler.Call(@"test", typeof(SimpleInterface), "ImplWithConstructor", "CallMe"); }
public void TestLoad() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test"); //reload CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test"); }
public void TestLoadDependConfigNotFound() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface1.json", @"test\out"); }
public void TestLoadDirectoryEmpty() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test\out"); }
public void TestLoadDirectoryNotFound() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test\notexist"); }
public void TestLoadCompileError() { CrossDomainCompiler.LoadScript(@"test\SimpleInterface.json", @"test\error"); }