Skip to content

Commit 0deaef3

Browse files
Fix warnings (#2391)
[no important files changed]
1 parent c3ac551 commit 0deaef3

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-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,3 +1,6 @@
1+
#pragma warning disable CS0660
2+
#pragma warning disable CS0661
3+
14
public struct CurrencyAmount
25
{
36
private decimal amount;
@@ -94,3 +97,6 @@ public static implicit operator decimal(CurrencyAmount @this)
9497
return @this.amount;
9598
}
9699
}
100+
101+
#pragma warning restore CS0660
102+
#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
@@ -148,7 +148,7 @@ public void Cannot_deposit_negative()
148148
}
149149

150150
[Fact(Skip = "Remove this Skip property to run this test")]
151-
public void Can_handle_concurrent_transactions()
151+
public async Task Can_handle_concurrent_transactions()
152152
{
153153
var account = new BankAccount();
154154
account.Open();
@@ -163,7 +163,7 @@ public void Can_handle_concurrent_transactions()
163163
account.Withdraw(1m);
164164
}
165165
}));
166-
Task.WaitAll(tasks.ToArray());
166+
await Task.WhenAll(tasks.ToArray());
167167
}
168168
Assert.Equal(0m, account.Balance);
169169
}

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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void Black_corner_territory_on_5x5_board()
1515
var expectedOwner = Owner.Black;
1616
var expectedCoordinates = new HashSet<(int, int)> { (0, 0), (0, 1), (1, 0) };
1717
Assert.Equal(expectedOwner, territoryOwner);
18-
Assert.Equal(expectedCoordinates, territoryCoordinates);
18+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
1919
}
2020

2121
[Fact(Skip = "Remove this Skip property to run this test")]
@@ -33,7 +33,7 @@ public void White_center_territory_on_5x5_board()
3333
var expectedOwner = Owner.White;
3434
var expectedCoordinates = new HashSet<(int, int)> { (2, 3) };
3535
Assert.Equal(expectedOwner, territoryOwner);
36-
Assert.Equal(expectedCoordinates, territoryCoordinates);
36+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
3737
}
3838

3939
[Fact(Skip = "Remove this Skip property to run this test")]
@@ -51,7 +51,7 @@ public void Open_corner_territory_on_5x5_board()
5151
var expectedOwner = Owner.None;
5252
var expectedCoordinates = new HashSet<(int, int)> { (0, 3), (0, 4), (1, 4) };
5353
Assert.Equal(expectedOwner, territoryOwner);
54-
Assert.Equal(expectedCoordinates, territoryCoordinates);
54+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
5555
}
5656

5757
[Fact(Skip = "Remove this Skip property to run this test")]
@@ -69,7 +69,7 @@ public void A_stone_and_not_a_territory_on_5x5_board()
6969
var expectedOwner = Owner.None;
7070
var expectedCoordinates = new HashSet<(int, int)>();
7171
Assert.Equal(expectedOwner, territoryOwner);
72-
Assert.Equal(expectedCoordinates, territoryCoordinates);
72+
Assert.Equal(expectedCoordinates, territoryCoordinates.ToHashSet());
7373
}
7474

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

0 commit comments

Comments
 (0)