private static SolutionAnalysis Analyze(GigasecondSolution gigasecondSolution)
        {
            if (gigasecondSolution.ReturnsAddSecondsWithScientificNotation())
            {
                return(gigasecondSolution.UsesExpressionBody()
                    ? gigasecondSolution.ApproveAsOptimal()
                    : gigasecondSolution.ApproveWithComment(SharedComments.UseExpressionBodiedMember));
            }

            if (gigasecondSolution.ReturnsAddSecondsWithMathPow())
            {
                return(gigasecondSolution.ApproveWithComment(GigasecondComments.UseScientificNotationNotMathPow));
            }

            if (gigasecondSolution.ReturnsAddSecondsWithDigitsWithoutSeparator())
            {
                return(gigasecondSolution.ApproveWithComment(GigasecondComments.UseScientificNotationOrDigitSeparators));
            }

            if (gigasecondSolution.UsesAddMethod() ||
                gigasecondSolution.UsesPlusOperator())
            {
                return(gigasecondSolution.DisapproveWithComment(GigasecondComments.UseAddSeconds));
            }

            return(gigasecondSolution.ReferToMentor());
        }
Beispiel #2
0
 private static SolutionAnalysis Analyze(GigasecondSolution gigasecondSolution) =>
 gigasecondSolution.DisapproveWhenInvalid() ??
 gigasecondSolution.ApproveWhenValid() ??
 gigasecondSolution.ReferToMentor();