Exemplo n.º 1
0
        /// <summary>
        /// This method gets the Server details from the test files.
        /// The $ separated server names and urls are written in the test case file.
        /// This method extract those values from the file and populates list of the type ServerDetail.
        /// </summary>
        /// <param name="testParameter">An array of the test parameters configured in the file.</param>
        /// <returns>List containing server details.</returns>
        private static List <ServerDetail> GetTestParameterServerDetails(TestParameter[] testParameter)
        {
            List <ServerDetail> ServerDetails = null;
            bool firstServerDetail            = false;

            if (testParameter == null || testParameter.Length == 0)
            {
                return(null);
            }

            char[] separator = { '$' };
            for (int i = 0; i < testParameter.Length; i++)
            {
                if (testParameter[i].Name == TestCases.ServerDetails)
                {
                    if (!firstServerDetail)
                    {
                        ServerDetails     = new List <ServerDetail>();
                        firstServerDetail = true;
                    }
                    string[] details = testParameter[i].Value.Split(separator);
                    if (details.Length != 2)
                    {
                        return(null);
                    }
                    ServerDetails.Add(new ServerDetail(details[0], details[1]));
                }
            }
            return(ServerDetails);
        }