public TestDataSuite(MethodInfo method, string xmlPath)
            : base(method.Name)
        {
            var xmlDoc = new XmlDocument();

            xmlDoc.Load(xmlPath);

            var namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable);

            namespaceManager.AddNamespace("tr", string.Empty);

            var xmlInputs = xmlDoc.SelectNodes(string.Format("/tr:data/tr:test[@name='{0}']", method.Name));

            foreach (XmlNode xmlInput in xmlInputs)
            {
                var arguments = new List <string>();

                // var exeConfigPath = new Uri(typeof(TestDataSuite).Assembly.Location).LocalPath;
                var exeConfigPath = new Uri(@"E:\Wallmart\Walmart.Testss\Scenarios\SearchItems\SearchItems.xml").LocalPath;

                foreach (var param in method.GetParameters())
                {
                    var xmlParam = xmlInput.SelectSingleNode(string.Format("/tr:param[@name='{0}']", param.Name), namespaceManager);
                    if (xmlParam != null)
                    {
                        arguments.Add(xmlParam.InnerText);
                    }
                    else
                    {
                        if (bool.Parse(ConfigurationManager.OpenExeConfiguration(exeConfigPath).AppSettings.Settings["IncludeTestDataCheck"].Value))
                        {
                            throw new ArgumentException(string.Format("Input data for '{0}' parameter not found in '{1}' test.", param.Name, method.Name));
                        }
                    }
                }

                for (var i = 0; i < arguments.Count; i++)
                {
                    if (OnTestDataBuild != null)
                    {
                        OnTestDataBuild(typeof(TestDataSuite), new TestDataBuildEventArgs(method.Name, method.GetParameters()[i].Name, arguments[i]));
                    }

                    var test = new WalmartTestMethod(method, arguments.ToArray());

                    Add(test);
                }
            }
        }
        /// <summary>
        /// Build test for NUnit from test method.
        /// </summary>
        /// <param name="method">Test method in test fixture.</param>
        /// <returns>Test object for NUnit.</returns>
        public Test BuildFrom(MethodInfo method)
        {
            try
            {
                if (method == null)
                {
                    throw new ArgumentNullException("method");
                }

                Test nunitMethod = null;

                if (method.GetParameters().Any())
                {
                    if (method.DeclaringType != null && method.DeclaringType.Namespace != null)
                    {
                        //var path =
                        //method.DeclaringType.Namespace.Replace("Walmart.Testss.", string.Empty).Replace(".", @"\") +
                        //@"\" + method.DeclaringType.Name;
                        var path = @"E:\Walmart Assignment\WalmartSmokeTestSolution\Walmart.Testss\Scenarios\SearchItems\SearchItems";
                        if (File.Exists(path + ".xml"))
                        {
                            nunitMethod = new TestDataSuite(method, path + ".xml");
                        }
                        else
                        {
                            throw new Exception(string.Format("Input file for suite not found on the following path : {0}", path));
                        }
                    }
                }
                else
                {
                    nunitMethod = new WalmartTestMethod(method);
                }

                //var exeConfigPath = new Uri(typeof(NUnitTestBuilder).Assembly.Location).LocalPath;
                //if (bool.Parse(ConfigurationManager.OpenExeConfiguration(exeConfigPath).AppSettings.Settings["IncludeSkipped"].Value))
                //{
                //    if (nunitMethod != null && !isCompatible)
                //    {
                //        nunitMethod.RunState = RunState.Ignored;
                //        nunitMethod.IgnoreReason = "Not compatible";
                //    }
                //}
                //else
                //{
                //    if (nunitMethod != null && !isCompatible)
                //    {
                //        nunitMethod = null;
                //    }
                //}

                if (OnTestBuild != null)
                {
                    OnTestBuild(typeof(NUnitTestBuilder), new TestBuildEventArgs(nunitMethod));
                }

                return(nunitMethod);
            }
            catch (Exception e)
            {
                Debug.Print("Something wrong with tests building.", e);
                throw;
            }
        }