private void LoadTestScripts()

in RuleTests/BaselinedRuleTest.cs [114:139]


        private void LoadTestScripts()
        {
            // Load all files ending in ".sql". Note that due to strange Win32 behavior we need to double check the
            // file name actually ends in ".sql" since suffixes like ".sqlOther" would also be included in the results
            DirectoryInfo di = new DirectoryInfo(ScriptsFolder);
            var scriptFilepaths = from file in di.GetFiles("*" + SqlExt)
                                  where SqlExt.Equals(file.Extension, StringComparison.OrdinalIgnoreCase)
                                  select file.FullName;               
                
            foreach(string scriptFile in scriptFilepaths)
            {
                try
                {
                    string contents = RuleTestUtils.ReadFileToString(scriptFile);
                    TestScripts.Add(Tuple.Create(contents, scriptFile));
                    Console.WriteLine("Test script file '{0}' loaded", scriptFile);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(
                        "Error reading from file '{0}', message is '{1}'. Continuing processing since missing files treated as warning for test",
                        scriptFile, 
                        ex.Message);
                }                
            }
        }