Esempio n. 1
0
        public string Config_File_Test(out pcTest_ConfigData config, out string folderApplication)
        {
            string folderTestCases;
            string configFile;
            var    result = _lamed.lib.Test.ConfigSettings(out folderApplication, out folderTestCases, out config, out configFile);

            if (result == false)
            {
                DebugLog("Error with unit test folder settings!");
                DebugLog(" Please correct. (Opening the running folder and the 'Config.json' file).");
                DebugLog($"  + Excel test case folder: '{folderTestCases}'");
                DebugLog($"  + Application Folder    : '{folderApplication}'");
            }
            // Following will test if the config file can be loaded
            // ===========================================================
            Assert.True(_lamed.lib.IO.Folder.Exists(folderApplication), folderApplication);
            Assert.NotEqual("", folderTestCases);
            Assert.True(_lamed.lib.IO.Folder.Exists(folderTestCases), $"Error! Folder: '{folderTestCases}' does not exists.");

            return(folderTestCases);
        }
Esempio n. 2
0
        /// <summary>Configuration settings for unit tests.</summary>
        /// <param name="folderApplication">The folder application.</param>
        /// <param name="folderTestCases">The folder excel test cases.</param>
        /// <param name="config">The configuration.</param>
        /// <param name="configFile">The configuration file.</param>
        /// <returns></returns>
        public bool ConfigSettings(out string folderApplication, out string folderTestCases, out pcTest_ConfigData config, out string configFile)
        {
            var result = _lamed.lib.IO.File.Config_UnitTests(out folderApplication, out folderTestCases, out config, out configFile);

            return(result);
        }
Esempio n. 3
0
        public bool Config_UnitTests(out string folderApplication, out string folderTestCases, out pcTest_ConfigData config, out string configFile)
        {
            // Protected area
            var result = true;

            lock (configLock)
            {
                configFile      = _lamed.lib.IO.File.Filename_Config();
                config          = _lamed.lib.IO.File.Config_Load <pcTest_ConfigData>();
                folderTestCases = config.Folder_TestCase;

                // Check if values are filled in
                result = (config.Folder_TestCase.zIsNullOrEmpty() == false);
                if (result)
                {
                    if (_lamed.lib.IO.Folder.Exists(folderTestCases) == false)
                    {
                        result = false;
                    }
                }

                // Following will test if the config file can be loaded
                // ===========================================================
                folderApplication = _lamed.lib.IO.Folder.Path_Application();
                if (result == false)
                {
                    // Unit tests
                    // The following code will not be tested by unit tests. It will only execute the first time tests are run on a new computer.
                    if (_firstRun == false)
                    {
                        return(false);                    // Only run this check once for all test cases
                    }
                    _firstRun = false;
                    _lamed.lib.IO.File.Config_Save(config); // Save the file to ensure new properties are available
                    _lamed.lib.Command.Execute_Explorer(folderApplication);
                    _lamed.lib.Command.Sleep(1500);
                    _lamed.lib.Command.Execute_Notepad("Config.json", folderApplication, true);
                }
            }
            return(result);
        }