public void Test_plugin_paths_from_JSON_options() { string exePath = Common.AasxPackageExplorerExe(); using (var tmpDir = new TemporaryDirectory()) { var jsonOptionsPath = Path.Combine(tmpDir.Path, "options-test.json"); var text = @"{ ""PluginDll"": [ { ""Path"": ""AasxIntegrationEmptySample.dll"", ""Args"": [], ""Options"": null }, { ""Path"": ""AasxPluginUaNetServer.dll"", ""Args"": [ ""-single-nodeids"", ""-single-keys"", ""-ns"", ""2"", ""-ns"", ""3"" ], ""Options"": null }, { ""Path"": ""AasxPluginBomStructure.dll"", ""Args"": [] } ]; }"; File.WriteAllText(jsonOptionsPath, text); var optionsInformation = App.InferOptions( exePath, new[] { "-read-json", jsonOptionsPath }); Assert.AreEqual(3, optionsInformation.PluginDll.Count); // TODO (mristin, 2020-11-13): @MIHO please check -- Options should be null, not empty? Assert.IsEmpty(optionsInformation.PluginDll[0].Args); Assert.IsEmpty(optionsInformation.PluginDll[0].Options); Assert.AreEqual(null, optionsInformation.PluginDll[0].DefaultOptions); Assert.AreEqual("AasxIntegrationEmptySample.dll", optionsInformation.PluginDll[0].Path); Assert.That(optionsInformation.PluginDll[1].Args, Is.EquivalentTo(new[] { "-single-nodeids", "-single-keys", "-ns", "2", "-ns", "3" })); Assert.IsEmpty(optionsInformation.PluginDll[1].Options); Assert.AreEqual(null, optionsInformation.PluginDll[1].DefaultOptions); Assert.AreEqual("AasxPluginUaNetServer.dll", optionsInformation.PluginDll[1].Path); Assert.IsEmpty(optionsInformation.PluginDll[2].Args); Assert.AreEqual(null, optionsInformation.PluginDll[2].Options); Assert.AreEqual(null, optionsInformation.PluginDll[2].DefaultOptions); Assert.AreEqual("AasxPluginBomStructure.dll", optionsInformation.PluginDll[2].Path); } }
public void Test_plugins_are_passed_arguments() { var optionsInformation = App.InferOptions( "NonExistingAasxPackageExplorer.exe", new[] { "-p", "-something", "-dll", "ACME-plugins\\AasxSomeACMEPlugin.dll" }); Assert.AreEqual(1, optionsInformation.PluginDll.Count); Assert.AreEqual("ACME-plugins\\AasxSomeACMEPlugin.dll", optionsInformation.PluginDll[0].Path); Assert.That(optionsInformation.PluginDll[0].Args, Is.EquivalentTo(new[] { "-something" })); }