Example #1
0
        /// <summary>
        /// Adds the given asset names to the local library and validates the result
        /// </summary>
        /// <param name="testRunner"></param>
        /// <param name="assetNames">The test assets to add to the library</param>
        public static void AddTestAssetsToLibrary(this AutomationRunner testRunner, params string[] assetNames)
        {
            // Switch to the Local Library tab
            testRunner.NavigateToFolder("Local Library Row Item Collection");

            // Assert that the requested items are *not* in the list
            foreach (string assetName in assetNames)
            {
                string friendlyName = Path.GetFileNameWithoutExtension(assetName);
                Assert.IsFalse(testRunner.WaitForName($"Row Item {friendlyName}", .1), $"{friendlyName} part should not exist at test start");
            }

            // Add Library item
            testRunner.InvokeLibraryAddDialog();

            // Generate the full, quoted paths for the requested assets
            string fullQuotedAssetPaths = string.Join(" ", assetNames.Select(name => $"\"{MatterControlUtilities.GetTestItemPath(name)}\""));

            testRunner.CompleteDialog(fullQuotedAssetPaths);

            // Assert that the added items *are* in the list
            foreach (string assetName in assetNames)
            {
                string friendlyName = Path.GetFileNameWithoutExtension(assetName);
                Assert.IsTrue(testRunner.WaitForName($"Row Item {friendlyName}"), $"{friendlyName} part should exist after adding");
            }
        }