Exemplo n.º 1
0
        protected virtual CheckerDetails PrepareAdminCheckerDetailsForInvalidNumberOfLines(
            int lineNumber,
            string userLine,
            string correctLine)
        {
            const int FragmentMaxLength = 256;

            var adminCheckerDetails = new CheckerDetails
            {
                Comment = string.Format("Invalid number of lines on line {0}", lineNumber)
            };

            var firstDifferenceIndex = correctLine.GetFirstDifferenceIndexWith(userLine, this.IgnoreCharCasing);

            if (correctLine != null)
            {
                adminCheckerDetails.ExpectedOutputFragment =
                    PrepareOutputFragment(correctLine, firstDifferenceIndex, FragmentMaxLength);
            }

            if (userLine != null)
            {
                adminCheckerDetails.UserOutputFragment =
                    PrepareOutputFragment(userLine, firstDifferenceIndex, FragmentMaxLength);
            }

            return(adminCheckerDetails);
        }
Exemplo n.º 2
0
        protected virtual CheckerDetails PrepareCheckerDetails(
            string receivedOutput,
            string expectedOutput,
            bool isTrialTest,
            CheckerDetails adminCheckerDetails)
        {
            CheckerDetails checkerDetails;

            if (isTrialTest)
            {
                const int FragmentMaxLength = 4096;

                checkerDetails = default(CheckerDetails);

                var firstDifferenceIndex = expectedOutput.GetFirstDifferenceIndexWith(receivedOutput, this.IgnoreCharCasing);

                if (expectedOutput != null)
                {
                    checkerDetails.ExpectedOutputFragment =
                        PrepareOutputFragment(expectedOutput, firstDifferenceIndex, FragmentMaxLength);
                }

                if (receivedOutput != null)
                {
                    checkerDetails.UserOutputFragment =
                        PrepareOutputFragment(receivedOutput, firstDifferenceIndex, FragmentMaxLength);
                }
            }
            else
            {
                // Test report for admins
                checkerDetails = adminCheckerDetails;
            }

            return(checkerDetails);
        }