Ejemplo n.º 1
0
        private static TestInfo GetTestInfoFromFile(string filename)
        {
            var testInfo = new TestInfo();

            var lines = File.ReadAllLines(filename);

            int    lineNumber          = 0;
            string supplyCollectorName = string.Empty;
            string connectionString    = string.Empty;

            foreach (string line in lines)
            {
                string trimmedLine = line.Trim();

                if (String.IsNullOrWhiteSpace(trimmedLine) || trimmedLine.StartsWith("#"))
                {
                    continue;
                }

                if (lineNumber == 0)
                {
                    testInfo.SupplyCollectorName = line;
                }

                if (lineNumber == 1)
                {
                    testInfo.ConnectionString = line;
                }

                if (lineNumber > 1)
                {
                    string[] lineParts = line.Split("|");

                    switch (lineParts[0].Trim().ToLowerInvariant())
                    {
                    case "getschema":
                        testInfo.SchemaTableCount  = Convert.ToInt32(lineParts[1]);
                        testInfo.SchemaEntityCount = Convert.ToInt32(lineParts[2]);
                        break;

                    case "collectsample":
                        testInfo.AddCollectSampleTest(lineParts);
                        break;

                    case "randomsample":
                        testInfo.AddRandomSampleTest(lineParts);
                        break;

                    case "datacollectionmetrics":
                        testInfo.AddMetricsTest(lineParts);
                        break;

                    case "loadtest":
                        testInfo.AddLoadTest(lineParts);
                        break;
                    }
                }

                lineNumber++;
            }


            return(testInfo);
        }