Skip to content

Commit 5e7efd0

Browse files
authored
Merge pull request #29 from NightAngell/net8Update
net8 update
2 parents 2bffd8b + 6a6117b commit 5e7efd0

14 files changed

+57
-38
lines changed

Directory.Build.props

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
3-
43
<PropertyGroup>
54
<!--Supported values:
6-
{net5.0, netstandard2.1},
7-
{net6.0, net6.0}
8-
{net7.0, net7.0}
9-
{net8.0, net8.0}
5+
{net5.0, netstandard2.1},
6+
{net6.0, net6.0}
7+
{net7.0, net7.0}
8+
{net8.0, net8.0}
109
It is also important to made sure that tests and example project have valid dependencies-->
1110
<TargetFrameworkForExampleAndTests>net8.0</TargetFrameworkForExampleAndTests>
1211
<TargetFrameworkForLib>net8.0</TargetFrameworkForLib>
1312

1413
<EntityFrameworkMinSupportedVersion>8.0.0</EntityFrameworkMinSupportedVersion>
1514
<EntityFrameworkCurrentVersion>8.0.*</EntityFrameworkCurrentVersion>
16-
<MicrosoftTestSDKVersion>17.8.0</MicrosoftTestSDKVersion>
15+
<MicrosoftTestSDKVersion>*</MicrosoftTestSDKVersion>
16+
17+
<!--I do not want to force any newer version of MOQ due to this:
18+
https://github.com/devlooped/moq/issues/1372-->
19+
<MoqMinVersion>4.18.4</MoqMinVersion>
20+
21+
<!--NUnit-->
22+
<NUnitMinSupportedVersion>4.0.1</NUnitMinSupportedVersion>
23+
<NUnitCurrentVersion>*</NUnitCurrentVersion>
24+
<NUnitTestAdapterCurrentVersion>*</NUnitTestAdapterCurrentVersion>
25+
26+
<!--MSTest-->
27+
<MsTestMinSupportedVersion>3.1.1</MsTestMinSupportedVersion>
28+
<MsTestCurrentVersion>*</MsTestCurrentVersion>
29+
<MsTestAdapterCurrentVersion>*</MsTestAdapterCurrentVersion>
30+
31+
<!--xUnit-->
32+
<xUnitMinSupportedVersion>2.6.4</xUnitMinSupportedVersion>
33+
<xUnitCurrentVersion>*</xUnitCurrentVersion>
34+
<xUnitRunnerCurrentVersion>*</xUnitRunnerCurrentVersion>
1735
</PropertyGroup>
1836

1937
<!-- Unit testing support nugets related config.

SignalR_UnitTestingSupport/SignalR_UnitTestingSupport.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
</ItemGroup>
4141

4242
<ItemGroup>
43-
<PackageReference Include="nunit" Version="3.13.3" />
43+
<PackageReference Include="nunit" Version="$(NUnitMinSupportedVersion)" />
4444
</ItemGroup>
4545
</Project>

SignalR_UnitTestingSupportCommon/SignalR_UnitTestingSupportCommon.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ https://github.com/NightAngell/SignalR_UnitTestingSupport/wiki/How-implement-tes
4848
<ItemGroup>
4949
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EntityFrameworkMinSupportedVersion)" />
5050
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EntityFrameworkMinSupportedVersion)" />
51-
<PackageReference Include="Moq" Version="4.18.2" />
51+
<PackageReference Include="Moq" Version="$(MoqMinVersion)" />
5252
</ItemGroup>
5353

5454
<ItemGroup>

SignalR_UnitTestingSupportMSTest/SignalR_UnitTestingSupportMSTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@
4141

4242
<ItemGroup>
4343
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
44-
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
44+
<PackageReference Include="MSTest.TestFramework" Version="$(MsTestMinSupportedVersion)" />
4545
</ItemGroup>
4646
</Project>

SignalR_UnitTestingSupportXUnit/SignalR_UnitTestingSupportXUnit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
</ItemGroup>
4141

4242
<ItemGroup>
43-
<PackageReference Include="xunit" Version="2.4.2" />
43+
<PackageReference Include="xunit" Version="$(xUnitMinSupportedVersion)" />
4444
</ItemGroup>
4545
</Project>

TestsWithIHubContextSupport/TestsForIHubContextForGenericHub.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Threading;
2-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
32
using ExampleSignalRCoreProject.Hubs;
43
using ExampleSignalRCoreProject.Hubs.Interfaces;
54
using ExampleSignalRCoreProject.Services;
@@ -116,7 +115,7 @@ public async Task GetMessageFromClient_MessageReceived()
116115

117116
var message = await _service.GetMessageFromClient();
118117

119-
Assert.AreEqual(expectedMessage, message);
118+
Assert.That(message, Is.EqualTo(expectedMessage));
120119
}
121120
}
122121
}

TestsWithIHubContextSupport/TestsForIHubContextForNonGenericHub.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma warning disable SA1009 // Closing parenthesis should be spaced correctly
22
#pragma warning disable SA1111 // Closing parenthesis should be on line of last parameter
3+
#pragma warning disable IDE0301 // Simplify collection initialization
34
using System;
45
using System.Threading;
56
using System.Threading.Tasks;
@@ -28,13 +29,13 @@ public void SetUp()
2829
public async Task NotifyAllAboutSomething_AllNotifiedAboutSomething()
2930
{
3031
await _service.NotifyAllAboutSomething();
32+
3133
_unitTestingSupport
3234
.ClientsAllMock
3335
.Verify(x => x.SendCoreAsync(
3436
ExampleNonGenericHub.NotifyUserAboutSomethingResponse,
3537
Array.Empty<object>(),
3638
It.IsAny<CancellationToken>()
37-
3839
), Times.Once());
3940
}
4041

@@ -156,9 +157,10 @@ public async Task GetMessageFromClient_MessageReceived()
156157

157158
var message = await _service.GetMessageFromClient();
158159

159-
Assert.AreEqual(expectedMessage, message);
160+
Assert.That(message, Is.EqualTo(expectedMessage));
160161
}
161162
}
162163
}
164+
#pragma warning restore IDE0301 // Simplify collection initialization
163165
#pragma warning restore SA1111 // Closing parenthesis should be on line of last parameter
164166
#pragma warning restore SA1009 // Closing parenthesis should be spaced correctly

TestsWithIHubContextSupport/TestsWithIHubContextSupport.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="nunit" Version="3.13.3" />
19-
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
18+
<PackageReference Include="nunit" Version="$(NUnitCurrentVersion)" />
19+
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterCurrentVersion)" />
2020
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
2121
</ItemGroup>
2222

TestsWithUnitTestingSupport/Hubs/ExampleHubTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ public void SetUpExampleHubTests()
2525
[Test]
2626
public void TryGetDbContexMock_DbContextMockSuccesfullyTaken()
2727
{
28-
Assert.NotNull(DbContextMock.Object);
28+
Assert.That(DbContextMock.Object, Is.Not.Null);
2929
}
3030

3131
[Test]
3232
public void TryGetDbInMemorySqlite_ClearDbInMemorySqliteSuccesfullyTaken()
3333
{
34-
Assert.Zero(DbInMemorySqlite.Note.Count());
34+
Assert.That(DbInMemorySqlite.Note.Count(), Is.Zero);
3535
}
3636

3737
[Test]
3838
public void TryGetDbInMemory_ClearDbInMemoryMockSuccesfullyTaken()
3939
{
40-
Assert.Zero(DbInMemory.Note.Count());
40+
Assert.That(DbInMemory.Note.Count(), Is.Zero);
4141
}
4242

4343
[Test]
4444
[TestCase]
4545
[TestCase]
4646
public async Task TryGetDbInMemorySqlite_WeGetClearInstanceOfDbInEveryTest()
4747
{
48-
Assert.IsTrue(DbInMemorySqlite.Note.Count() == 0);
48+
Assert.That(DbInMemorySqlite.Note.Count(), Is.EqualTo(0));
4949

5050
DbInMemorySqlite.Note.Add(new Note { Content = "test content" });
5151
await DbInMemorySqlite.SaveChangesAsync();
@@ -56,7 +56,7 @@ public async Task TryGetDbInMemorySqlite_WeGetClearInstanceOfDbInEveryTest()
5656
[TestCase]
5757
public async Task TryGetDbInMemory_WeGetClearInstanceOfDbInEveryTest()
5858
{
59-
Assert.IsTrue(DbInMemory.Note.Count() == 0);
59+
Assert.That(DbInMemory.Note.Count(), Is.EqualTo(0));
6060

6161
DbInMemory.Note.Add(new Note { Content = "test content" });
6262
await DbInMemory.SaveChangesAsync();
@@ -236,7 +236,7 @@ public async Task AddNoteWithLoremIpsumAsContentToDb_dbProviderIsSqliteInMemory_
236236
await _exampleHub.AddNoteWithLoremIpsumAsContentToDb();
237237

238238
var noteFromDb = DbInMemorySqlite.Note.FirstOrDefault();
239-
Assert.NotNull(noteFromDb);
239+
Assert.That(noteFromDb, Is.Not.Null);
240240
}
241241

242242
[Test]
@@ -248,7 +248,7 @@ public async Task AddNoteWithLoremIpsumAsContentToDb_dbProviderIsInMemory_NoteAd
248248
await _exampleHub.AddNoteWithLoremIpsumAsContentToDb();
249249

250250
var noteFromDb = DbInMemory.Note.FirstOrDefault();
251-
Assert.NotNull(noteFromDb);
251+
Assert.That(noteFromDb, Is.Not.Null);
252252
}
253253

254254
[Test]
@@ -264,7 +264,7 @@ public async Task GetMessageFromClient_MessageReceived()
264264

265265
var message = await _exampleHub.GetMessageFromClient();
266266

267-
Assert.AreEqual(expectedMessage, message);
267+
Assert.That(message, Is.EqualTo(expectedMessage));
268268
}
269269
}
270270
}

TestsWithUnitTestingSupport/Hubs/ExampleNonGenericHubTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,27 @@ public void SetUpExampleNonGenericHubTests()
2626
[Test]
2727
public void TryGetDbContexMock_DbContextMockSuccesfullyTaken()
2828
{
29-
Assert.NotNull(DbContextMock.Object);
29+
Assert.That(DbContextMock.Object, Is.Not.Null);
3030
}
3131

3232
[Test]
3333
public void TryGetDbInMemorySqlite_ClearDbInMemorySqliteSuccesfullyTaken()
3434
{
35-
Assert.Zero(DbInMemorySqlite.Note.Count());
35+
Assert.That(DbInMemorySqlite.Note.Count(), Is.Zero);
3636
}
3737

3838
[Test]
3939
public void TryGetDbInMemory_ClearDbInMemoryMockSuccesfullyTaken()
4040
{
41-
Assert.Zero(DbInMemory.Note.Count());
41+
Assert.That(DbInMemory.Note.Count(), Is.Zero);
4242
}
4343

4444
[Test]
4545
[TestCase]
4646
[TestCase]
4747
public async Task TryGetDbInMemorySqlite_WeGetClearInstanceOfDbInEveryTest()
4848
{
49-
Assert.IsTrue(DbInMemorySqlite.Note.Count() == 0);
49+
Assert.That(DbInMemorySqlite.Note.Count(), Is.EqualTo(0));
5050

5151
DbInMemorySqlite.Note.Add(new Note { Content = "test content" });
5252
await DbInMemorySqlite.SaveChangesAsync();
@@ -57,7 +57,7 @@ public async Task TryGetDbInMemorySqlite_WeGetClearInstanceOfDbInEveryTest()
5757
[TestCase]
5858
public async Task TryGetDbInMemory_WeGetClearInstanceOfDbInEveryTest()
5959
{
60-
Assert.IsTrue(DbInMemory.Note.Count() == 0);
60+
Assert.That(DbInMemory.Note.Count(), Is.EqualTo(0));
6161

6262
DbInMemory.Note.Add(new Note { Content = "test content" });
6363
await DbInMemory.SaveChangesAsync();
@@ -223,7 +223,7 @@ public async Task GetMessageFromClient_MessageReceived()
223223

224224
var message = await _exampleHub.GetMessageFromClient();
225225

226-
Assert.AreEqual(expectedMessage, message);
226+
Assert.That(message, Is.EqualTo(expectedMessage));
227227
}
228228
}
229229
}

TestsWithUnitTestingSupport/Hubs/V1.0.1FeaturesTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void HubUnitTestsBaseAlwaysSameInScopeOfTest()
1818
string connId1 = ContextMock.Object.ConnectionId;
1919
string connId2 = ContextMock.Object.ConnectionId;
2020

21-
Assert.AreEqual(connId1, connId2);
21+
Assert.That(connId2, Is.EqualTo(connId1));
2222
}
2323

2424
[Test]

TestsWithUnitTestingSupport/TestsWithUnitTestingSupport.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EntityFrameworkCurrentVersion)" />
1919
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EntityFrameworkCurrentVersion)" />
2020
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EntityFrameworkCurrentVersion)" />
21-
<PackageReference Include="nunit" Version="3.13.3" />
22-
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
21+
<PackageReference Include="nunit" Version="$(NUnitCurrentVersion)" />
22+
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterCurrentVersion)" />
2323
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
2424
</ItemGroup>
2525

TestsWithUnitTestingSupportMSTest/TestsWithUnitTestingSupportMSTest.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EntityFrameworkCurrentVersion)" />
2020
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EntityFrameworkCurrentVersion)" />
2121
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
22-
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
23-
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
22+
<PackageReference Include="MSTest.TestAdapter" Version="$(MsTestAdapterCurrentVersion)" />
23+
<PackageReference Include="MSTest.TestFramework" Version="$(MsTestCurrentVersion)" />
2424
</ItemGroup>
2525

2626
<ItemGroup>

TestsWithUnitTestingSupportXUnit/TestsWithUnitTestingSupportXUnit.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EntityFrameworkCurrentVersion)" />
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
1414

15-
<PackageReference Include="xunit" Version="2.6.4" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
15+
<PackageReference Include="xunit" Version="$(xUnitCurrentVersion)" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="$(xUnitRunnerCurrentVersion)">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1919
</PackageReference>

0 commit comments

Comments
 (0)