コード例 #1
0
        public void Test_simple_iec_cdd_data_source()
        {
            var aasxPath      = Common.PathTo01FestoAasx();
            var dictImportDir = Path.Combine(Common.TestResourcesDir(), "IecCdd", "simple");

            Common.RunWithMainWindow((application, automation, mainWindow) =>
            {
                Common.RequireMenuItem(mainWindow, "File", "Import ..", "Import Submodel from Dictionary ..").Click();

                var window = Common.RequireTopLevelWindowByTitle(application, automation, "Dictionary Import");

                var comboBoxDataSources = window.FindFirstChild("ComboBoxSource").AsComboBox();
                var dataSources         = comboBoxDataSources.Items;
                Assert.That(dataSources.Length == 1,
                            "Expected one default sources for the dictionary import dir 'simple'");
                var dataSource = dataSources[0].Text;
                Assert.That(dataSource == "IEC CDD: simple",
                            $"Unexpected label for the simple IEC CDD data source: '{dataSource}'");

                comboBoxDataSources.Select(0);

                var topLevelView     = window.FindFirstChild("ClassViewControl").AsListBox();
                var topLevelElements = Retry.WhileEmpty(() => topLevelView.Items,
                                                        timeout: TimeSpan.FromSeconds(5),
                                                        throwOnTimeout: true,
                                                        timeoutMessage: "Could not find top-level elements from simple IEC CDD source"
                                                        ).Result;

                Assert.That(topLevelElements.Select(e => e.Text), Is.EqualTo(new[] { "C1", "C2", "C3" }),
                            "Unexpected top-level elements for the simple IEC CDD source");

                Common.AssertNoErrors(application, mainWindow);
            }, new Run {
                Args = new[] { "-dict-import-dir", dictImportDir, aasxPath }
            });
        }