Beispiel #1
0
        public void GetVariableValueText_CorrectVariableXmlRoot_ReturnText(string key, Type type, string value, string searchKey)
        {
            var doc = new XmlDocument();

            doc.LoadXml(value);
            variableContext.SetVariable(key, type, doc);

            var variable = variableContext.GetVariableValueText(searchKey);

            variable.Should().BeNull();
        }
Beispiel #2
0
        public void StoreVariableTextToVariable(string varName, string newVarName)
        {
            var value = variableController.GetVariableValueText(varName);

            value.Should().NotBeNull($"содержимого в переменной \"{varName}\" нет");

            variableController.SetVariable(newVarName, value.GetType(), value);
        }
Beispiel #3
0
        private string GetBody()
        {
            var name  = headers.FirstOrDefault(h => h.Style == HeaderType.BODY)?.Value;
            var value = variableController.GetVariableValueText(name);

            return(value ?? name);
        }
Beispiel #4
0
        public void Output(string varName)
        {
            this.variables.Variables.Should().ContainKey(varName, $"переменная \"{varName}\" не существует");
            var value = variables.GetVariableValueText(varName);

            output.WriteLine($"Variable value is {value}");
        }
Beispiel #5
0
        public static void Before(VariableController variableController, DatabaseController databaseController)
        {
            var connectionsStringBuilder = new SqlConnectionStringBuilder
            {
                DataSource     = variableController.GetVariableValueText("SOURCE"),
                InitialCatalog = variableController.GetVariableValueText("DATABASE"),
                UserID         = variableController.GetVariableValueText("LOGIN"),
                Password       = variableController.GetVariableValueText("PASSWORD"),
                ConnectTimeout = 60
            };

            var connection = new SqlServerClient();

            connection.Create(connectionsStringBuilder);
            connection.IsConnectAlive();
            databaseController.Connections.TryAdd("QA", (connection, typeOfAccess: Molder.Infrastructures.TypeOfAccess.Global, connectionsStringBuilder.ConnectTimeout));
        }
Beispiel #6
0
        public static void RemoveDirectories(VariableController variableController)
        {
            var userDir = variableController.GetVariableValueText(Infrastructures.Constants.USER_DIR);

            if (Directory.Exists(userDir))
            {
                Directory.Delete(userDir, true);
            }
        }
Beispiel #7
0
        private string GetBody()
        {
            var isCheck = headers.Count(h => h.Style == HeaderType.BODY);

            if (isCheck == 1)
            {
                var name  = headers.FirstOrDefault(h => h.Style == HeaderType.BODY).Value;
                var value = variableController.GetVariableValueText(name);
                return(value != null?variableController.ReplaceVariables(value) : name);
            }
            return(null);
        }
Beispiel #8
0
        public void Create()
        {
            var fields = SettingHelper.GetAllFields(typeof(DefaultSetting));

            foreach (var field in fields)
            {
                if (field.Name == Setting.REMOTE_RUN.GetValue())
                {
                    Remote = _variableController.GetVariableValue(Setting.REMOTE_RUN.GetValue()).ToString().GetValueOrNull <bool>() ?? DefaultSetting.REMOTE_RUN;
                }

                if (field.Name == Setting.HEADLESS.GetValue())
                {
                    Headless = _variableController.GetVariableValue(Setting.HEADLESS.GetValue()).ToString().GetValueOrNull <bool>() ?? DefaultSetting.HEADLESS;
                }

                if (field.Name == Setting.BROWSER.GetValue())
                {
                    BrowserType = _variableController.GetVariableValue(Setting.BROWSER.GetValue()) != null ? (BrowserType)Enum.Parse(typeof(BrowserType), _variableController.GetVariableValueText(Setting.BROWSER.GetValue())) : DefaultSetting.BROWSER;
                }

                if (field.Name == Setting.BROWSER_PATH.GetValue())
                {
                    BrowserPath = (string)_variableController.GetVariableValue(Setting.BROWSER_PATH.GetValue()) ?? DefaultSetting.BROWSER_PATH;
                }

                if (field.Name == Setting.REMOTE_URL.GetValue())
                {
                    RemoteUrl = (string)_variableController.GetVariableValue(Setting.REMOTE_URL.GetValue()) ?? DefaultSetting.REMOTE_URL;
                }

                if (field.Name == Setting.BROWSER_VERSION.GetValue())
                {
                    RemoteVersion = (string)_variableController.GetVariableValue(Setting.BROWSER_VERSION.GetValue()) ?? DefaultSetting.BROWSER_VERSION;
                }

                if (field.Name == Setting.BROWSER_TIMEOUT.GetValue())
                {
                    Timeout = ((int?)(int.TryParse(_variableController.GetVariableValue(Setting.BROWSER_TIMEOUT.GetValue()).ToString(), out var f) ? f : default)) ?? DefaultSetting.BROWSER_TIMEOUT;
Beispiel #9
0
        public void Output(string varName)
        {
            var value = variables.GetVariableValueText(varName);

            Console.WriteLine($"Variable value is {value}");
        }