Example #1
0
        /// <summary>
        /// Checks the output produced when the converted solution
        /// was run by cygwin.
        /// </summary>
        private static TestResults checkResults(SolutionInfo solutionInfo)
        {
            TestResults results = new TestResults();

            results.Result = TestResults.PassFail.PASSED;

            // The solution folder should contain a file called testExpectedResults.txt.
            // This contains lines like:
            // [output-file-name] = [expected-output]
            // (There may be multiple lines so that we can test multiple configurations
            // of the solutions.)

            // We read each line from the expected-results file...
            string expectedResultsFilename = String.Format("{0}/testExpectedResults.txt", solutionInfo.Folder);

            string[] lines = File.ReadAllLines(expectedResultsFilename);
            foreach (string line in lines)
            {
                // We get the filename and expected result from the line...
                List <string> tokens = Utils.split(line, '=');
                if (tokens.Count != 2)
                {
                    throw new Exception(String.Format("Lines should be in the format [output-file-name] = [expected-output]. File={0}", expectedResultsFilename));
                }
                string file           = solutionInfo.Folder + "/" + tokens[0].Trim();
                string expectedResult = tokens[1].Trim();

                // We read the data from the output file, and compare it
                // with the expected results...
                string actualResult = File.ReadAllText(file);
                if (actualResult != expectedResult)
                {
                    results.Result       = TestResults.PassFail.FAILED;
                    results.Description += String.Format("Expected '{0}', got '{1}'.", expectedResult, actualResult);
                }
            }

            return(results);
        }
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            // We find the background color...
            Color backgroundColor = SystemColors.Window;

            if (e.Index < Items.Count)
            {
                SolutionInfo solutionInfo = (SolutionInfo)Items[e.Index];
                backgroundColor = solutionInfo.BackgroundColor;
            }
            DrawItemEventArgs e2 =
                new DrawItemEventArgs
                (
                    e.Graphics,
                    e.Font,
                    new Rectangle(e.Bounds.Location, e.Bounds.Size),
                    e.Index,
                    e.State,
                    e.ForeColor,
                    backgroundColor
                );

            base.OnDrawItem(e2);
        }