Esempio n. 1
0
        private bool TrySetReturnValue(bool any = false)
        {
            var returnInfo =
                ReturnValues.Where(r => r.Invocation == (any ? FakesProvider.AllInvocations : (int)InvocationCount))
                .ToList();

            if (returnInfo.Count <= 0)
            {
                return(false);
            }
            ReturnValue = returnInfo.First().ReturnValue;
            return(true);
        }
Esempio n. 2
0
        protected bool TrySetReturnValue(bool any = false)
        {
            var returnInfo =
                ReturnValues.Where(r => r.Invocation == (any ? FakesProvider.AllInvocations : (int)InvocationCount) &&
                                   r.Argument != null &&
                                   r.Argument == string.Empty).ToList();

            if (returnInfo.Count <= 0)
            {
                return(false);
            }
            ReturnValue = returnInfo.First().ReturnValue;
            return(true);
        }
Esempio n. 3
0
        protected bool TrySetReturnValue(string parameter, object value, bool any = false)
        {
            var returnInfo =
                ReturnValues.Where(r => r.Invocation == (any ? FakesProvider.AllInvocations : (int)InvocationCount) &&
                                   r.Argument != null &&
                                   r.Parameter.Equals(parameter.ToLower()) &&
                                   value.Equals(r.Argument)).ToList();      // use this order instead of r.Argument.Equals(value) to use Equals method for ComVariant

            if (returnInfo.Count <= 0)
            {
                return(false);
            }
            ReturnValue = returnInfo.First().ReturnValue;
            return(true);
        }
Esempio n. 4
0
        private bool TrySetReturnValue(string parameter, object value, bool any = false)
        {
            var returnInfo =
                ReturnValues.Where(r => r.Invocation == (any ? FakesProvider.AllInvocations : (int)InvocationCount) &&
                                   r.Argument != null &&
                                   r.Parameter.Equals(parameter.ToLower()) &&
                                   r.Argument.Equals(value)).ToList();

            if (returnInfo.Count <= 0)
            {
                return(false);
            }
            ReturnValue = returnInfo.First().ReturnValue;
            return(true);
        }
Esempio n. 5
0
        private void XMLValidation(string xml)
        {
            XmlDocument xmlReqDoc = new XmlDocument();

            xmlReqDoc.LoadXml(xml);

            // Steps
            // 1. Read Source File and replace Place Holders
            // 2. Copy To target file
            // 3. Wait for processed file to exist
            // 4. read target file into Act.ReturnValues
            try
            {
                foreach (ActInputValue aiv in DynamicElements)
                {
                    ValueExpression VE = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VE.Value = @aiv.Param;
                    // var.Value = VE.ValueCalculated;

                    XmlNode node = xmlReqDoc.SelectSingleNode(VE.ValueCalculated);
                    if (node.InnerText != null)
                    {
                        AddOrUpdateReturnParamActualWithPath("InnerText", node.InnerText.ToString(), VE.ValueCalculated);
                    }

                    if (aiv.Value == null || aiv.Value == String.Empty)
                    {
                        foreach (XmlAttribute XA in node.Attributes)
                        {
                            ActReturnValue rv = ReturnValues.Where(x => x.Path == XA.Name).FirstOrDefault();
                            if (rv == null)
                            {
                                AddOrUpdateReturnParamActualWithPath(aiv.Param, XA.Value.ToString(), XA.Name);
                            }
                            else
                            {
                                rv.Actual = XA.Value.ToString();
                            }
                        }
                    }
                    else
                    {
                        if (node.Attributes != null)
                        {
                            var            nameAttribute = node.Attributes[@aiv.Value];
                            ActReturnValue rv            = ReturnValues.Where(x => x.Path == aiv.Value).FirstOrDefault();
                            if (rv == null)
                            {
                                AddOrUpdateReturnParamActualWithPath(aiv.Param, nameAttribute.Value.ToString(), aiv.Value);
                            }
                            else
                            {
                                rv.Actual = nameAttribute.Value.ToString();
                            }
                        }
                    }
                }
            }

            catch (Exception e)
            {
                Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}");
                throw new System.ArgumentException("Node not found at provided path");
            }
        }
Esempio n. 6
0
        public void ParseOutput()
        {
            string ResponseMessage = ReturnValues.Where(x => x.Param == "Response").FirstOrDefault().Actual;

            ParseNodesToReturnParams(this, ResponseMessage);
        }