Sha256: 7cb828510aa76404875d945ab6477af8c08b8a3eb82e063f365966d392926af1

Contents?: true

Size: 1.05 KB

Versions: 78

Compression:

Stored size: 1.05 KB

Contents

using System;
using Generators.Data;
using Generators.Methods;
using Humanizer;

namespace Generators.Exercises
{
    public class PerfectNumbersExercise : EqualityExercise
    {
        public PerfectNumbersExercise() : base("perfect-numbers")
        {
        }

        protected override TestMethodData CreateTestMethodData(CanonicalData canonicalData, CanonicalDataCase canonicalDataCase, int index)
        {
            var testMethodData = base.CreateTestMethodData(canonicalData, canonicalDataCase, index);
            testMethodData.Options.ExceptionType = typeof(ArgumentOutOfRangeException);
            testMethodData.Options.FormatExpected = false;

            if (testMethodData.CanonicalDataCase.Expected is string classificationType)
                testMethodData.CanonicalDataCase.Expected = GetClassification(classificationType);

            return testMethodData;
        }

        private static string GetClassification(string classificationType) 
            => $"Classification.{classificationType.Transform(Humanizer.To.TitleCase)}";
    }
}

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
trackler-2.1.0.48 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.47 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.46 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.45 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.44 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.43 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.42 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.41 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.40 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.39 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.38 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.37 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.36 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.34 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.33 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.32 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.31 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.30 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.29 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
trackler-2.1.0.28 tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs