tracks/csharp/generators/Exercises/Meetup.cs in trackler-2.2.1.107 vs tracks/csharp/generators/Exercises/Meetup.cs in trackler-2.2.1.108
- old
+ new
@@ -8,12 +8,11 @@
{
public class Meetup : GeneratorExercise
{
private const string ParamYear = "year";
private const string ParamMonth = "month";
- private const string ParamDay = "dayofmonth";
- private const string ParamSchedule = "week";
+ private const string ParamWeek = "week";
private const string ParamDayOfWeek = "dayofweek";
private const string PropertyDay = "Day";
protected override void UpdateCanonicalData(CanonicalData canonicalData)
@@ -21,23 +20,23 @@
foreach (var canonicalDataCase in canonicalData.Cases)
{
canonicalDataCase.Property = PropertyDay;
canonicalDataCase.UseVariableForExpected = true;
canonicalDataCase.SetConstructorInputParameters(ParamMonth, ParamYear);
- canonicalDataCase.SetInputParameters(ParamDayOfWeek, ParamSchedule);
+ canonicalDataCase.SetInputParameters(ParamDayOfWeek, ParamWeek);
- canonicalDataCase.Properties[ParamSchedule] =
- new UnescapedValue($"Schedule.{((string)canonicalDataCase.Properties[ParamSchedule]).Transform(To.SentenceCase)}");
+ canonicalDataCase.Properties[ParamYear] = canonicalDataCase.Properties["input"][ParamYear];
+ canonicalDataCase.Properties[ParamMonth] = canonicalDataCase.Properties["input"][ParamMonth];
+ canonicalDataCase.Properties[ParamWeek] =
+ new UnescapedValue($"Schedule.{((string)canonicalDataCase.Properties["input"][ParamWeek]).Transform(To.SentenceCase)}");
canonicalDataCase.Properties[ParamDayOfWeek] =
- new UnescapedValue($"DayOfWeek.{((string)canonicalDataCase.Properties[ParamDayOfWeek]).Transform(To.SentenceCase)}");
- canonicalDataCase.Expected =
- $"{canonicalDataCase.Properties[ParamYear]}-{canonicalDataCase.Properties[ParamMonth]}-{canonicalDataCase.Properties[ParamDay]}";
+ new UnescapedValue($"DayOfWeek.{((string)canonicalDataCase.Properties["input"][ParamDayOfWeek]).Transform(To.SentenceCase)}");
}
}
protected override String RenderTestMethodBodyAssert(TestMethodBody testMethodBody)
{
- string template = $"Assert.Equal({{{{ ExpectedParameter }}}}, {{{{ TestedValue }}}}.ToString(\"yyyy-M-d\"));";
+ string template = $"Assert.Equal({{{{ ExpectedParameter }}}}, {{{{ TestedValue }}}}.ToString(\"yyyy-MM-dd\"));";
return TemplateRenderer.RenderInline(template, testMethodBody.AssertTemplateParameters);
}
protected override HashSet<String> AddAdditionalNamespaces() => new HashSet<string> { typeof(DayOfWeek).Namespace };