public void Test_plugin_paths_from_default_JSON_options() { using (var tmpDir = new TemporaryDirectory()) { var exePath = Path.Combine(tmpDir.Path, "NonexistingAasxPackageExplorer.exe"); var optionsPath = Path.Combine(tmpDir.Path, "NonexistingAasxPackageExplorer.options.json"); var text = @"{ ""PluginDir"": "".\\AcmePlugins"", ""PluginDll"": [ { ""Path"": ""AasxPluginBomStructure.dll"", ""Args"": [] } ]; }"; File.WriteAllText(optionsPath, text); var optionsInformation = App.InferOptions( exePath, new string[] { }); Assert.AreEqual(".\\AcmePlugins", optionsInformation.PluginDir); Assert.AreEqual(1, optionsInformation.PluginDll.Count); Assert.IsEmpty(optionsInformation.PluginDll[0].Args); Assert.AreEqual(null, optionsInformation.PluginDll[0].Options); Assert.AreEqual(null, optionsInformation.PluginDll[0].DefaultOptions); Assert.AreEqual("AasxPluginBomStructure.dll", optionsInformation.PluginDll[0].Path); } }
public void Constructor_Name_Value() { // This function tests a constructor that accepts // a name and initial value. vCardProperty property = new vCardProperty("NAME", "VALUE"); Assert.AreEqual( "NAME", property.Name, "The name is incorrect."); Assert.AreEqual( "VALUE", property.Value, "The value is incorrect."); Assert.IsNotNull( property.Subproperties, "The subproperties collection was not created."); Assert.IsEmpty( property.Subproperties, "The subproperties collection should be empty."); }
public void Constructor() { // Tests the default values of the address constructor. vCardDeliveryAddress address = new vCardDeliveryAddress(); Assert.IsEmpty( address.City, "The City property should default to String.Empty."); Assert.IsEmpty( address.Country, "The Country property should default to String.Empty."); Assert.IsEmpty( address.PostalCode, "The PostalCode property should default to String.Empty."); Assert.IsEmpty( address.Region, "The Region property should default to String.Empty."); Assert.IsEmpty( address.Street, "The Street property should default to String.Empty."); }
public void DecodeQuotedPrintable_Empty() { // Empty should be returned if Empty is specified. Assert.IsEmpty( vCardStandardReader.DecodeQuotedPrintable(string.Empty)); }
public void Constructor_NullUrl() { vCardWebsite site = new vCardWebsite((string)null); Assert.IsEmpty( site.Url, "The Url should be String.Empty even when initialized to null."); }
public void Constructor() { vCardEmailAddress email = new vCardEmailAddress(); Assert.IsEmpty( email.Address, "The Address property should default to String.Empty."); }
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); } }
protected virtual void RunTestLog(log4net.ILog log) { log.Info("Hola!"); var events = GetEvents(log.Logger); Assert.AreEqual(1, events.Length, "events Count"); var le = events.Single(); Assert.IsNotNull(le, "loggingevent"); Assert.IsEmpty(le.Properties, "loggingevent Properties"); }
public void EmptyString_PostalCode() { vCardDeliveryAddress address = new vCardDeliveryAddress(); Assert.IsEmpty( address.PostalCode, "The PostalCode property should default to String.Empty."); address.PostalCode = null; Assert.IsEmpty( address.PostalCode, "The PostalCode property should return String.Empty instead of null."); }
public void StringEmpty_Office() { vCard card = new vCard(); Assert.IsEmpty( card.Office, "Office is not string.Empty."); card.Office = null; Assert.IsEmpty( card.Office, "Office is not string.Empty after being assigned null."); }
public void StringEmpty_Mailer() { vCard card = new vCard(); Assert.IsEmpty( card.Mailer, "Mailer is not string.Empty."); card.Mailer = null; Assert.IsEmpty( card.Mailer, "Mailer is not string.Empty after being assigned null."); }
public void StringEmpty_NameSuffix() { vCard card = new vCard(); Assert.IsEmpty( card.NameSuffix, "NameSuffix is not string.Empty."); card.NameSuffix = null; Assert.IsEmpty( card.NameSuffix, "NameSuffix is not string.Empty after being assigned null."); }
public void StringEmpty_Department() { vCard card = new vCard(); Assert.IsEmpty( card.Department, "Department is not string.Empty."); card.Department = null; Assert.IsEmpty( card.Department, "Department is not string.Empty after being assigned null."); }
public void StringEmpty_GivenName() { vCard card = new vCard(); Assert.IsEmpty( card.GivenName, "GivenName is not string.Empty."); card.GivenName = null; Assert.IsEmpty( card.GivenName, "GivenName is not string.Empty after being assigned null."); }
public void EmptyString_KeyType() { vCardCertificate cert = new vCardCertificate(); Assert.IsEmpty( cert.KeyType, "The string KeyType property should default to String.Empty."); cert.KeyType = null; Assert.IsEmpty( cert.KeyType, "The string KeyType should be String.Empty when assigned null."); }
public void StringEmpty_Title() { vCard card = new vCard(); Assert.IsEmpty( card.Title, "Title is not string.Empty."); card.Title = null; Assert.IsEmpty( card.Title, "Title is not string.Empty after being assigned null."); }
public static void AssertLoad(Application application, Window mainWindow, string path) { if (!File.Exists(path)) { throw new InvalidOperationException($"The AASX file to be loaded does not exist: {path}"); } var fileMenuItem = mainWindow .FindFirstDescendant( cf => cf.ByClassName("MenuItem").And(cf.ByName("File"))) .AsMenuItem(); fileMenuItem.Click(); var openMenuItem = fileMenuItem .FindFirstChild(cf => cf.ByName("Open ..")) .AsMenuItem(); openMenuItem.Click(); Retry.WhileEmpty( () => mainWindow.ModalWindows, throwOnTimeout: true, timeout: TimeSpan.FromSeconds(10)); Assert.AreEqual(1, mainWindow.ModalWindows.Length); var modal = mainWindow.ModalWindows[0]; var pathCombo = modal.FindFirstChild(cf => cf.ByAutomationId("1148")).AsComboBox(); pathCombo.EditableText = path; var openButton = modal.FindFirstChild(cf => cf.ByAutomationId("1")).AsButton(); openButton.Click(); Assert.IsEmpty(modal.ModalWindows, $"Unexpected modal window (probably an error) while opening the AASX: {path}"); Retry.WhileTrue(() => mainWindow.ModalWindows.Length > 0, throwOnTimeout: true, timeout: TimeSpan.FromSeconds(10)); if (application.HasExited) { throw new AssertionException( "The application unexpectedly exited. " + $"Check manually why the file could not be opened: {path}"); } AssertNoErrors(application, mainWindow); }
public void EmptyString_FullNumber() { vCardPhone phone = new vCardPhone(); Assert.IsEmpty( phone.FullNumber, "The full number should default to String.Empty."); phone.FullNumber = null; Assert.IsEmpty( phone.FullNumber, "The FullNumber property should return String.Empty instead of null."); }
public void EmptyString_Country() { vCardDeliveryAddress address = new vCardDeliveryAddress(); Assert.IsEmpty( address.Country, "The Country property should default to String.Empty."); address.Country = null; Assert.IsEmpty( address.Country, "The Country property should return String.Empty instead of null."); }
public void StringEmpty_UniqueId() { vCard card = new vCard(); Assert.IsEmpty( card.UniqueId, "UniqueId is not string.Empty."); card.UniqueId = null; Assert.IsEmpty( card.UniqueId, "UniqueId is not string.Empty after being assigned null."); }
public void EmptyString_Street() { vCardDeliveryAddress address = new vCardDeliveryAddress(); Assert.IsEmpty( address.Street, "The Street property should default to String.Empty."); address.Street = null; Assert.IsEmpty( address.Street, "The Street property should return String.Empty instead of null."); }
public void EmptyString_Region() { vCardDeliveryAddress address = new vCardDeliveryAddress(); Assert.IsEmpty( address.Region, "The Region property should default to String.Empty."); address.Region = null; Assert.IsEmpty( address.Region, "The Region property should return String.Empty instead of null."); }
public void StringEmpty_Organization() { vCard card = new vCard(); Assert.IsEmpty( card.Organization, "Organization is not string.Empty."); card.Organization = null; Assert.IsEmpty( card.Organization, "Organization is not string.Empty after being assigned null."); }
public void StringEmpty_AdditionalNames() { vCard card = new vCard(); Assert.IsEmpty( card.AdditionalNames, "AdditionalNames is not string.Empty."); card.AdditionalNames = null; Assert.IsEmpty( card.AdditionalNames, "AdditionalNames is not string.Empty after being assigned null."); }
public void Constructor() { // Tests the default values of the vCardSource // class when the parameterless constructor is used. vCardSource source = new vCardSource(); Assert.IsEmpty( source.Context, "The Context property should default to empty."); Assert.IsNull( source.Uri, "The Uri property should default to null."); }
public void Constructor() { vCardProperty property = new vCardProperty(); Assert.IsNotNull( property.Subproperties, "The subproperties collection was not created."); Assert.IsEmpty( property.Subproperties, "The subproperties collection should be empty."); Assert.IsNull( property.Value, "The value should be null."); }
public void Constructor() { // Tests for default values when a web site // object is created without parameters. vCardWebsite site = new vCardWebsite(); Assert.AreEqual( site.WebsiteType, vCardWebsiteTypes.Default, "The site type should be the default."); Assert.IsEmpty( site.Url, "The Url should be String.Empty because it was not initialized."); }
public void Test_that_it_works() { using (var tmpDir = new TemporaryDirectory()) { var jsonOptionsPath = Path.Combine(tmpDir.Path, "options-test.json"); var exePath = Common.AasxPackageExplorerExe(); var pluginPath = Path.Combine( TestContext.CurrentContext.TestDirectory, "TestResources\\AasxPackageExplorer.Tests\\AasxPluginGenericForms.dll"); Assert.IsTrue(File.Exists(pluginPath), pluginPath); var text = $@"{{ ""PluginDll"": [ {{ ""Path"": {JsonConvert.ToString(pluginPath)}, ""Args"": [] }} ] }}"; File.WriteAllText(jsonOptionsPath, text); var optionsInformation = App.InferOptions( exePath, new[] { "-read-json", jsonOptionsPath }); Assert.AreEqual(1, optionsInformation.PluginDll.Count); Assert.IsEmpty(optionsInformation.PluginDll[0].Args); Assert.AreEqual(null, optionsInformation.PluginDll[0].Options); Assert.AreEqual(null, optionsInformation.PluginDll[0].DefaultOptions); Assert.AreEqual(pluginPath, optionsInformation.PluginDll[0].Path); // ReSharper disable UnusedVariable var loadedPlugins = App.LoadAndActivatePlugins(optionsInformation.PluginDll); // TODO (Marko Ristin, 2021-07-09): not clear, how this test could pass. As of today, // it is failing and therefore disabled //// Assert.AreEqual(new[] { "AasxPluginGenericForms" }, loadedPlugins.Keys.ToList()); // TODO (Marko Ristin, 2021-07-09): could not fix //// Assert.IsNotNull(loadedPlugins["AasxPluginGenericForms"]); // This is not a comprehensive test, but it would fail if the plugin DLL has not been properly loaded. //// Assert.Greater(loadedPlugins["AasxPluginGenericForms"].ListActions().Length, 0); } }
public void Constructor_Name() { vCardProperty property = new vCardProperty("NAME"); Assert.AreEqual( "NAME", property.Name, "The name is incorrect."); Assert.IsNull( property.Value, "The value should be null."); Assert.IsNotNull( property.Subproperties, "The subproperties collection was not created."); Assert.IsEmpty( property.Subproperties, "The subproperties collection should be empty."); }
public void ReadProperty_String_Name_Value() { // This function tests the parsing function // against a basic string like NAME:VALUE. vCardStandardReader reader = new vCardStandardReader(); vCardProperty property = reader.ReadProperty( TestName + ":" + TestValue); Assert.AreEqual( TestName, property.Name); Assert.AreEqual( TestValue, property.Value, "The parsed value is incorrect."); Assert.IsEmpty( property.Subproperties, "The Subproperties collection should be empty."); }