Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/update-exercises.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ $PSNativeCommandUseErrorActionPreference = $true
& bin/fetch-configlet

if ($Exercise) {
& configlet sync --docs --metadata --filepaths --update --yes --exercise $Exercise
& bin/configlet sync --docs --metadata --filepaths --update --yes --exercise $Exercise
& dotnet run --project generators update --exercise $Exercise
} else {
& configlet sync --docs --metadata --filepaths --update --yes
& bin/configlet sync --docs --metadata --filepaths --update --yes
& dotnet run --project generators update
}
6 changes: 3 additions & 3 deletions exercises/practice/bank-account/.meta/Generator.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class {{ testClass }}
Assert.Equal({{ test.expected }}m, account.{{ op | to_call }});
{{ end -}}
{{- else if op.operation == "concurrent" }}
var tasks = new List<Task>();
for (int i = 0; i < 500; i++)
{
var tasks = new List<Task>();
tasks.Add(Task.Factory.StartNew(() =>
{
for (int j = 0; j < 100; j++)
Expand All @@ -44,9 +44,9 @@ public class {{ testClass }}
account.{{ nested_op | to_call }};
{{- end -}}
}
}));
await Task.WhenAll(tasks.ToArray());
}, TestContext.Current.CancellationToken));
}
await Task.WhenAll(tasks.ToArray());
{{- else }}
account.{{ op | to_call }};
{{- end -}}
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/bank-account/BankAccountTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ public async Task Can_handle_concurrent_transactions()
{
var account = new BankAccount();
account.Open();
var tasks = new List<Task>();
for (int i = 0; i < 500; i++)
{
var tasks = new List<Task>();
tasks.Add(Task.Factory.StartNew(() =>
{
for (int j = 0; j < 100; j++)
Expand All @@ -163,8 +163,8 @@ public async Task Can_handle_concurrent_transactions()
account.Withdraw(1m);
}
}, TestContext.Current.CancellationToken));
await Task.WhenAll(tasks.ToArray());
}
await Task.WhenAll(tasks.ToArray());
Assert.Equal(0m, account.Balance);
}
}
2 changes: 1 addition & 1 deletion generators/Generators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="Humanizer.Core" Version="3.0.10" />
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.3.0" />
<PackageReference Include="Scriban" Version="6.5.5" />
<PackageReference Include="Scriban" Version="7.0.6" />
<PackageReference Include="Tomlyn" Version="1.1.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion generators/Templates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static string RenderTestsCode(CanonicalData canonicalData)
scriptObject.Import("enum", new Func<string, string, string>((text, enumType) =>
$"{enumType.Pascalize()}.{text.Pascalize()}"));
scriptObject.Import("property", new Func<ScriptArray, string, ScriptArray>((testCases, name) =>
new ScriptArray(testCases.Cast<ScriptObject>().Where(testCase => testCase["property"].ToString() == name))));
new ScriptArray(testCases.Cast<ScriptObject>().Where(testCase => testCase["property"]?.ToString() == name))));
scriptObject.Import(TemplateData.ForCanonicalData(canonicalData));

var context = new TemplateContext();
Expand Down
10 changes: 5 additions & 5 deletions generators/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
},
"Scriban": {
"type": "Direct",
"requested": "[6.5.5, )",
"resolved": "6.5.5",
"contentHash": "TxsmDVQ9agPQaY+SvdTO+zntGpJOnL1QaO4dzACfc6gEKRYhoMpzCCFuVixEZXet291sRnjyym6lB69Cr/EXPQ=="
"requested": "[7.0.6, )",
"resolved": "7.0.6",
"contentHash": "bOtHyk30sjl0y3+KYImIJv0ETZYLuFFJvlBF2ks2YLNtydhJqxRTGe4WaBDvg/3VRhhI6uf+qVfixuFROsOi+w=="
},
"Tomlyn": {
"type": "Direct",
Expand All @@ -56,8 +56,8 @@
},
"Microsoft.CodeAnalysis.Analyzers": {
"type": "Transitive",
"resolved": "5.3.0-2.final",
"contentHash": "VzdevMuvWpgH5s7bj+Y8CHaAPvJvzdRjBL/f2bzCEugZIOFOCZfblsbHwbCJ3hUFvvrbbcLcTrLt6HIj3bngAw=="
"resolved": "5.3.0-2.25625.1",
"contentHash": "4Yhh2fnu3G+J0J1lDc8WZVgMjgbynSeTfkl5IFJMFrmiIO0sc7Tjx+f3sFVV8Sd35PrIUWfof0RWc3lAMl7Azg=="
},
"Microsoft.CodeAnalysis.Common": {
"type": "Transitive",
Expand Down
Loading