Skip to content

Commit 33c8bfa

Browse files
dealprocRichard Bennett
authored andcommitted
Changes xunit dependency library from v2.x to v3.x for ReactiveDomain.Foundation.Tests class library.
1 parent d5b1d0f commit 33c8bfa

File tree

5 files changed

+36
-44
lines changed

5 files changed

+36
-44
lines changed

src/ReactiveDomain.Foundation.Tests/ReactiveDomain.Foundation.Tests.csproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,8 @@
1515
</ItemGroup>
1616
<ItemGroup>
1717
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
18-
<PackageReference Include="xunit" Version="2.9.2" />
1918
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
20-
<PackageReference Include="xunit.runner.console" Version="2.9.2">
21-
<PrivateAssets>all</PrivateAssets>
22-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
23-
</PackageReference>
24-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
25-
<PrivateAssets>all</PrivateAssets>
26-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
27-
</PackageReference>
19+
<PackageReference Include="xunit.v3" Version="1.1.0" />
2820
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
2921
</ItemGroup>
3022
<ItemGroup>

src/ReactiveDomain.Foundation.Tests/StreamListenerTests/when_using_listener_start_with_future_stream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void validation_throws_on_mising_stream()
4242
new PrefixedCamelCaseStreamNameBuilder(),
4343
_eventSerializer);
4444
listener.EventStream.Subscribe(new AdHocHandler<Event>(Handle));
45-
Assert.Throws<ArgumentException>(() => listener.Start(missingStream, validateStream: true));
45+
Assert.Throws<ArgumentException>(() => listener.Start(missingStream, validateStream: true, cancelWaitToken: TestContext.Current.CancellationToken));
4646
listener.Dispose();
4747
}
4848
[Fact]
@@ -55,7 +55,7 @@ public void can_subscribe_to_missing_stream()
5555
new PrefixedCamelCaseStreamNameBuilder(),
5656
_eventSerializer);
5757
listener.EventStream.Subscribe(new AdHocHandler<Event>(Handle));
58-
listener.Start(missingStream, validateStream: false);
58+
listener.Start(missingStream, validateStream: false, cancelWaitToken: TestContext.Current.CancellationToken);
5959
Assert.True(listener.IsLive);
6060
listener.Dispose();
6161
}

src/ReactiveDomain.Foundation.Tests/when_using_read_model_base.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void can_start_streams_by_aggregate()
6161
var aggId = Guid.NewGuid();
6262
var s1 = Namer.GenerateForAggregate(typeof(TestAggregate), aggId);
6363
AppendEvents(1, _conn, s1, 7);
64-
Start<TestAggregate>(aggId);
64+
Start<TestAggregate>(aggId, cancelWaitToken: TestContext.Current.CancellationToken);
6565
AssertEx.AtLeastModelVersion(this, 2, msg: $"Expected 2 got {Version}"); // 1 message + CatchupSubscriptionBecameLive
6666
AssertEx.IsOrBecomesTrue(() => Sum == 7);
6767
}
@@ -73,15 +73,15 @@ public void can_start_streams_by_aggregate_category()
7373
AppendEvents(1, _conn, s1, 7);
7474
var s2 = Namer.GenerateForAggregate(typeof(ReadModelTestCategoryAggregate), Guid.NewGuid());
7575
AppendEvents(1, _conn, s2, 5);
76-
Start<ReadModelTestCategoryAggregate>(null, true);
76+
Start<ReadModelTestCategoryAggregate>(null, true, cancelWaitToken: TestContext.Current.CancellationToken);
7777

7878
AssertEx.AtLeastModelVersion(this, 3, msg: $"Expected 3 got {Version}");
7979
AssertEx.IsOrBecomesTrue(() => Sum == 12);
8080
}
8181
[Fact]
8282
public void can_read_one_stream()
8383
{
84-
Start(_stream1);
84+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
8585
AssertEx.AtLeastModelVersion(this, 11, msg: $"Expected 11 got {Version}");
8686
AssertEx.IsOrBecomesTrue(() => Sum == 20);
8787
//confirm checkpoints
@@ -91,8 +91,8 @@ public void can_read_one_stream()
9191
[Fact]
9292
public void can_read_two_streams()
9393
{
94-
Start(_stream1);
95-
Start(_stream2);
94+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
95+
Start(_stream2, cancelWaitToken: TestContext.Current.CancellationToken);
9696
AssertEx.AtLeastModelVersion(this, 22, msg: $"Expected 22 got {Version}");
9797
AssertEx.IsOrBecomesTrue(() => Sum == 50);
9898
//confirm checkpoints
@@ -104,25 +104,25 @@ public void can_read_two_streams()
104104
[Fact]
105105
public void can_wait_for_one_stream_to_go_live()
106106
{
107-
Start(_stream1, null, true);
107+
Start(_stream1, null, true, cancelWaitToken: TestContext.Current.CancellationToken);
108108
AssertEx.AtLeastModelVersion(this, 11, TimeSpan.FromMilliseconds(100), msg: $"Expected 11 got {Version}");
109109
AssertEx.IsOrBecomesTrue(() => Sum == 20, 100);
110110
}
111111
[Fact]
112112
public void can_wait_for_two_streams_to_go_live()
113113
{
114-
Start(_stream1, null, true);
114+
Start(_stream1, null, true, cancelWaitToken: TestContext.Current.CancellationToken);
115115
AssertEx.AtLeastModelVersion(this, 11, TimeSpan.FromMilliseconds(100), msg: $"Expected 11 got {Version}");
116116
AssertEx.IsOrBecomesTrue(() => Sum == 20, 150);
117117

118-
Start(_stream2, null, true);
118+
Start(_stream2, null, true, cancelWaitToken: TestContext.Current.CancellationToken);
119119
AssertEx.AtLeastModelVersion(this, 21, TimeSpan.FromMilliseconds(100), msg: $"Expected 21 got {Version}");
120120
AssertEx.IsOrBecomesTrue(() => Sum == 50, 150);
121121
}
122122
[Fact]
123123
public void can_listen_to_one_stream()
124124
{
125-
Start(_stream1);
125+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
126126
AssertEx.AtLeastModelVersion(this, 11, msg: $"Expected 11 got {Version}");
127127
AssertEx.IsOrBecomesTrue(() => Sum == 20);
128128
//add more messages
@@ -137,8 +137,8 @@ public void can_listen_to_one_stream()
137137
[Fact]
138138
public void can_listen_to_two_streams()
139139
{
140-
Start(_stream1);
141-
Start(_stream2);
140+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
141+
Start(_stream2, cancelWaitToken: TestContext.Current.CancellationToken);
142142
AssertEx.AtLeastModelVersion(this, 22, msg: $"Expected 22 got {Version}");
143143
AssertEx.IsOrBecomesTrue(() => Sum == 50);
144144
//add more messages
@@ -159,7 +159,7 @@ public void can_use_checkpoint_on_one_stream()
159159
var checkPoint = 8L;//Zero based, ignore the first 9 events
160160
Sum = 18;
161161
//start at the checkpoint
162-
Start(_stream1, checkPoint);
162+
Start(_stream1, checkPoint, cancelWaitToken: TestContext.Current.CancellationToken);
163163
//add the one recorded event
164164
AssertEx.AtLeastModelVersion(this, 2, TimeSpan.FromMilliseconds(100), msg: $"Expected 2 got {Version}");
165165
AssertEx.IsOrBecomesTrue(() => Sum == 20);
@@ -180,8 +180,8 @@ public void can_use_checkpoint_on_two_streams()
180180
var checkPoint1 = 8L;//Zero based, ignore the first 9 events
181181
var checkPoint2 = 5L;//Zero based, ignore the first 6 events
182182
Sum = (9 * 2) + (6 * 3);
183-
Start(_stream1, checkPoint1);
184-
Start(_stream2, checkPoint2);
183+
Start(_stream1, checkPoint1, cancelWaitToken: TestContext.Current.CancellationToken);
184+
Start(_stream2, checkPoint2, cancelWaitToken: TestContext.Current.CancellationToken);
185185
//add the recorded events 2 on stream 1 & 5 on stream 2
186186
AssertEx.AtLeastModelVersion(this, 7, msg: $"Expected 7 got {Version}");
187187
AssertEx.IsOrBecomesTrue(() => Sum == 50, msg: $"Expected 50 got {Sum}");
@@ -202,8 +202,8 @@ public void can_listen_to_the_same_stream_twice()
202202
Assert.Equal(0, Version);
203203
//weird but true
204204
//n.b. Don't do this on purpose
205-
Start(_stream1);
206-
Start(_stream1);
205+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
206+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
207207
//double events
208208
AssertEx.AtLeastModelVersion(this, 22, msg: $"Expected 22 got {Version}");
209209
AssertEx.IsOrBecomesTrue(() => Sum == 40);

src/ReactiveDomain.Foundation.Tests/when_using_read_model_base_with_reader.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void can_start_streams_by_aggregate()
6060
var aggId = Guid.NewGuid();
6161
var s1 = Namer.GenerateForAggregate(typeof(TestAggregate), aggId);
6262
AppendEvents(1, _conn, s1, 7);
63-
Start<TestAggregate>(aggId);
63+
Start<TestAggregate>(aggId, cancelWaitToken: TestContext.Current.CancellationToken);
6464
AssertEx.IsOrBecomesTrue(() => Count == 1, 1000, msg: $"Expected 1 got {Count}");
6565
AssertEx.IsOrBecomesTrue(() => Sum == 7);
6666
}
@@ -72,15 +72,15 @@ public void can_start_streams_by_aggregate_category()
7272
AppendEvents(1, _conn, s1, 7);
7373
var s2 = Namer.GenerateForAggregate(typeof(ReadModelTestCategoryAggregate), Guid.NewGuid());
7474
AppendEvents(1, _conn, s2, 5);
75-
Start<ReadModelTestCategoryAggregate>(null, true);
75+
Start<ReadModelTestCategoryAggregate>(null, true, cancelWaitToken: TestContext.Current.CancellationToken);
7676

7777
AssertEx.IsOrBecomesTrue(() => Count == 2, 1000, msg: $"Expected 2 got {Count}");
7878
AssertEx.IsOrBecomesTrue(() => Sum == 12);
7979
}
8080
[Fact]
8181
public void can_read_one_stream()
8282
{
83-
Start(_stream1);
83+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
8484
AssertEx.IsOrBecomesTrue(() => Count == 10, 1000, msg: $"Expected 10 got {Count}");
8585
AssertEx.IsOrBecomesTrue(() => Sum == 20);
8686
//confirm checkpoints
@@ -90,8 +90,8 @@ public void can_read_one_stream()
9090
[Fact]
9191
public void can_read_two_streams()
9292
{
93-
Start(_stream1);
94-
Start(_stream2);
93+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
94+
Start(_stream2, cancelWaitToken: TestContext.Current.CancellationToken);
9595
AssertEx.IsOrBecomesTrue(() => Count == 20, 1000, msg: $"Expected 20 got {Count}");
9696
AssertEx.IsOrBecomesTrue(() => Sum == 50);
9797
//confirm checkpoints
@@ -103,25 +103,25 @@ public void can_read_two_streams()
103103
[Fact]
104104
public void can_wait_for_one_stream_to_go_live()
105105
{
106-
Start(_stream1, null, true);
106+
Start(_stream1, null, true, cancelWaitToken: TestContext.Current.CancellationToken);
107107
AssertEx.IsOrBecomesTrue(() => Count == 10, 100, msg: $"Expected 10 got {Count}");
108108
AssertEx.IsOrBecomesTrue(() => Sum == 20, 100);
109109
}
110110
[Fact]
111111
public void can_wait_for_two_streams_to_go_live()
112112
{
113-
Start(_stream1, null, true);
113+
Start(_stream1, null, true, cancelWaitToken: TestContext.Current.CancellationToken);
114114
AssertEx.IsOrBecomesTrue(() => Count == 10, 100, msg: $"Expected 10 got {Count}");
115115
AssertEx.IsOrBecomesTrue(() => Sum == 20, 100);
116116

117-
Start(_stream2, null, true);
117+
Start(_stream2, null, true, cancelWaitToken: TestContext.Current.CancellationToken);
118118
AssertEx.IsOrBecomesTrue(() => Count == 20, 100, msg: $"Expected 20 got {Count}");
119119
AssertEx.IsOrBecomesTrue(() => Sum == 50, 100);
120120
}
121121
[Fact]
122122
public void can_listen_to_one_stream()
123123
{
124-
Start(_stream1);
124+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
125125
AssertEx.IsOrBecomesTrue(() => Count == 10, 1000, msg: $"Expected 10 got {Count}");
126126
AssertEx.IsOrBecomesTrue(() => Sum == 20);
127127
//add more messages
@@ -136,8 +136,8 @@ public void can_listen_to_one_stream()
136136
[Fact]
137137
public void can_listen_to_two_streams()
138138
{
139-
Start(_stream1);
140-
Start(_stream2);
139+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
140+
Start(_stream2, cancelWaitToken: TestContext.Current.CancellationToken);
141141
AssertEx.IsOrBecomesTrue(() => Count == 20, 1000, msg: $"Expected 20 got {Count}");
142142
AssertEx.IsOrBecomesTrue(() => Sum == 50);
143143
//add more messages
@@ -159,7 +159,7 @@ public void can_use_checkpoint_on_one_stream()
159159
Count = 9;
160160
Sum = 18;
161161
//start at the checkpoint
162-
Start(_stream1, checkPoint);
162+
Start(_stream1, checkPoint, cancelWaitToken: TestContext.Current.CancellationToken);
163163
//add the one recorded event
164164
AssertEx.IsOrBecomesTrue(() => Count == 10, 100, msg: $"Expected 10 got {Count}");
165165
AssertEx.IsOrBecomesTrue(() => Sum == 20);
@@ -179,8 +179,8 @@ public void can_use_checkpoint_on_two_streams()
179179
var checkPoint2 = 5L;//Zero based, ignore the first 6 events
180180
Count = (9) + (6);
181181
Sum = (9 * 2) + (6 * 3);
182-
Start(_stream1, checkPoint1);
183-
Start(_stream2, checkPoint2);
182+
Start(_stream1, checkPoint1, cancelWaitToken: TestContext.Current.CancellationToken);
183+
Start(_stream2, checkPoint2, cancelWaitToken: TestContext.Current.CancellationToken);
184184
//add the recorded events 2 on stream 1 & 5 on stream 2
185185
AssertEx.IsOrBecomesTrue(() => Count == 20, 1000, msg: $"Expected 20 got {Count}");
186186
AssertEx.IsOrBecomesTrue(() => Sum == 50, msg: $"Expected 50 got {Sum}");
@@ -201,8 +201,8 @@ public void can_listen_to_the_same_stream_twice()
201201
Assert.Equal(0, Count);
202202
//weird but true
203203
//n.b. Don't do this on purpose
204-
Start(_stream1);
205-
Start(_stream1);
204+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
205+
Start(_stream1, cancelWaitToken: TestContext.Current.CancellationToken);
206206
//double events
207207
AssertEx.IsOrBecomesTrue(() => Count == 20, 1000, msg: $"Expected 20 got {Count}");
208208
AssertEx.IsOrBecomesTrue(() => Sum == 40);

src/ReactiveDomain.Foundation.Tests/when_using_snapshot_read_model.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void can_restore_state_without_checkpoints() {
120120
AssertEx.IsOrBecomesTrue(() => rm.Sum == 20);
121121

122122
//can manually start
123-
rm.Start<SnapReadModelTestAggregate>(_aggId, 9, true);
123+
rm.Start<SnapReadModelTestAggregate>(_aggId, 9, true, cancelWaitToken: TestContext.Current.CancellationToken);
124124
AssertEx.IsOrBecomesTrue(() => rm.Count == 11, 1000);
125125
AssertEx.IsOrBecomesTrue(() => rm.Sum == 25);
126126
AppendEvents(1, _conn, _stream, 5);

0 commit comments

Comments
 (0)