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.180 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.179 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.178 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.177 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.176 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.175 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.174 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.173 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.172 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.171 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.170 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.169 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.167 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.166 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.165 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.164 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.163 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.162 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.161 tracks/csharp/generators/Output/ExerciseWriter.cs
trackler-2.2.1.160 tracks/csharp/generators/Output/ExerciseWriter.cs