Skip to content

Commit 0288386

Browse files
Fix warnings (#2391)
[no important files changed]
1 parent 1081dd0 commit 0288386

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

exercises/concept/hyperia-forex/.meta/Exemplar.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using System.Runtime.InteropServices;
33

4+
#pragma warning disable CS0660
5+
#pragma warning disable CS0661
6+
47
public struct CurrencyAmount
58
{
69
private decimal amount;
@@ -97,3 +100,6 @@ public static implicit operator decimal(CurrencyAmount @this)
97100
return @this.amount;
98101
}
99102
}
103+
104+
#pragma warning restore CS0660
105+
#pragma warning restore CS0661

exercises/practice/bank-account/.meta/Generator.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class {{ testClass }}
2828
{
2929
{{- for test in tests }}
3030
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
31-
public void {{ test.testMethod }}()
31+
public {{ if test.scenarios | array.contains "concurrent" }}async Task{{ else }}void{{ end }} {{ test.testMethod }}()
3232
{
3333
var account = new {{ testedClass }}();
3434
{{- for op in test.input.operations }}
@@ -51,7 +51,7 @@ public class {{ testClass }}
5151
{{- end -}}
5252
}
5353
}));
54-
Task.WaitAll(tasks.ToArray());
54+
await Task.WhenAll(tasks.ToArray());
5555
}
5656
{{- else }}
5757
account.{{ op | to_call }};

exercises/practice/bank-account/BankAccountTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void Cannot_deposit_negative()
153153
}
154154

155155
[Fact(Skip = "Remove this Skip property to run this test")]
156-
public void Can_handle_concurrent_transactions()
156+
public async Task Can_handle_concurrent_transactions()
157157
{
158158
var account = new BankAccount();
159159
account.Open();
@@ -168,7 +168,7 @@ public void Can_handle_concurrent_transactions()
168168
account.Withdraw(1m);
169169
}
170170
}));
171-
Task.WaitAll(tasks.ToArray());
171+
await Task.WhenAll(tasks.ToArray());
172172
}
173173
Assert.Equal(0m, account.Balance);
174174
}

exercises/practice/go-counting/.meta/Generator.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using Xunit;
45

56
public class {{ testClass }}
@@ -26,7 +27,7 @@ public class {{ testClass }}
2627
var expectedOwner = {{ test.expected.owner | string.downcase | enum "Owner" }};
2728
var expectedCoordinates = new HashSet<(int, int)>{{ if test.expected.territory.empty? }}(){{ else }}{ {{ for territory in test.expected.territory }}({{ territory | array.join ", " }}){{ if !for.last }}, {{ end }}{{ end }} }{{ end }};
2829
Assert.Equal(expectedOwner, territoryOwner);
29-
Assert.Equal(expectedCoordinates, territoryCoordinates);
30+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
3031
{{- else if test.property == "territories" }}
3132
var actual = sut.Territories();
3233
var expected = new Dictionary<Owner, HashSet<(int, int)>>

exercises/practice/go-counting/GoCountingTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using Xunit;
45

56
public class GoCountingTests
@@ -19,7 +20,7 @@ public void Black_corner_territory_on_5x5_board()
1920
var expectedOwner = Owner.Black;
2021
var expectedCoordinates = new HashSet<(int, int)> { (0, 0), (0, 1), (1, 0) };
2122
Assert.Equal(expectedOwner, territoryOwner);
22-
Assert.Equal(expectedCoordinates, territoryCoordinates);
23+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
2324
}
2425

2526
[Fact(Skip = "Remove this Skip property to run this test")]
@@ -37,7 +38,7 @@ public void White_center_territory_on_5x5_board()
3738
var expectedOwner = Owner.White;
3839
var expectedCoordinates = new HashSet<(int, int)> { (2, 3) };
3940
Assert.Equal(expectedOwner, territoryOwner);
40-
Assert.Equal(expectedCoordinates, territoryCoordinates);
41+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
4142
}
4243

4344
[Fact(Skip = "Remove this Skip property to run this test")]
@@ -55,7 +56,7 @@ public void Open_corner_territory_on_5x5_board()
5556
var expectedOwner = Owner.None;
5657
var expectedCoordinates = new HashSet<(int, int)> { (0, 3), (0, 4), (1, 4) };
5758
Assert.Equal(expectedOwner, territoryOwner);
58-
Assert.Equal(expectedCoordinates, territoryCoordinates);
59+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
5960
}
6061

6162
[Fact(Skip = "Remove this Skip property to run this test")]
@@ -73,7 +74,7 @@ public void A_stone_and_not_a_territory_on_5x5_board()
7374
var expectedOwner = Owner.None;
7475
var expectedCoordinates = new HashSet<(int, int)>();
7576
Assert.Equal(expectedOwner, territoryOwner);
76-
Assert.Equal(expectedCoordinates, territoryCoordinates);
77+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
7778
}
7879

7980
[Fact(Skip = "Remove this Skip property to run this test")]

0 commit comments

Comments
 (0)