Sha256: 93255ccd7fe06885f5ef0f779f9e23c9ee8531d2816e99a6d4004db818b0e052
Contents?: true
Size: 789 Bytes
Versions: 70
Compression:
Stored size: 789 Bytes
Contents
using System.Linq; namespace Generators.Methods { public static class TestMethodRenderer { private const string Tab = " "; private const string TestMethodTemplate = @"{Tab}[Fact{Skip}] {Tab}public void {Name}() {Tab}{ {Body} {Tab}}"; public static string Render(TestMethod testMethod) => TestMethodTemplate .Replace("{Tab}", Tab) .Replace("{Name}", testMethod.MethodName) .Replace("{Body}", RenderBody(testMethod)) .Replace("{Skip}", testMethod.Index == 0 ? "" : "(Skip = \"Remove to run test\")"); private static string RenderBody(TestMethod testMethod) => string.Join("\n", testMethod.Body.Split('\n').Select(line => $"{Tab}{Tab}{line}")); } }
Version data entries
70 entries across 70 versions & 1 rubygems