Sha256: 92856336b26b1f8456e948420af5f42e9f10db963a49a43ed29c372250803989

Contents?: true

Size: 805 Bytes

Versions: 114

Compression:

Stored size: 805 Bytes

Contents

using System.IO;

namespace Generators.Output
{
    public class ExerciseWriter
    {
        public virtual void WriteToFile(GeneratorExercise generatorExercise)
        {
            var testClassFilePath = TestClassFilePath(generatorExercise);
            var testClassContents = generatorExercise.Render();

            Directory.CreateDirectory(Path.GetDirectoryName(testClassFilePath));
            File.WriteAllText(testClassFilePath, testClassContents);
        }

        private static string TestClassFilePath(GeneratorExercise generatorExercise) => Path.Combine("..", "exercises", generatorExercise.Name, TestClassFileName(generatorExercise));

        private static string TestClassFileName(GeneratorExercise generatorExercise) => $"{generatorExercise.Name.ToTestClassName()}.cs";
    }
}

Version data entries

114 entries across 114 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.97 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.96 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.95 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.94 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.93 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.92 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.91 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.90 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.89 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.88 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.87 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.86 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.85 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.84 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.83 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.82 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.81 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.80 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.79 tracks/csharp/generators/Output/ExerciseWriter.cs