Skip to content

Commit

Permalink
test: run tests using .NET 8 (#34)
Browse files Browse the repository at this point in the history
* Run tests using .NET 8
* Mark serialisation tests as obsolete because BinaryFormatter is obsolete
* Set EnableUnsafeBinaryFormatterSerialization
  • Loading branch information
hazzik authored Mar 22, 2024
1 parent 160941a commit 8bea87a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.1.x
dotnet-version: 8.0.x

- name: Build
run: dotnet build src -c Release -p:ContinuousIntegrationBuild=true
Expand All @@ -29,7 +29,7 @@ jobs:
run: |
.\net40\Iesi.Collections.Test.exe
.\net461\Iesi.Collections.Test.exe
.\netcoreapp3.1\Iesi.Collections.Test.exe
.\net8.0\Iesi.Collections.Test.exe
working-directory: src\Iesi.Collections.Test\bin\Release

- name: Pack
Expand Down
2 changes: 1 addition & 1 deletion default.build
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<call target="run-tests" />
<property name="test.file" value="${tests.basedir}/net461/Iesi.Collections.Test.exe" />
<call target="run-tests" />
<property name="test.file" value="${tests.basedir}/netcoreapp3.1/Iesi.Collections.Test.dll" />
<property name="test.file" value="${tests.basedir}/net8.0/Iesi.Collections.Test.dll" />
<call target="run-core-tests" />
</target>

Expand Down
2 changes: 2 additions & 0 deletions src/Iesi.Collections.Test/Generic/LinkedHashSetFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public void ShouldPreserveOrderingOnSymmetricExcept()

#if !NETCOREAPP1_0
[Test(Description = "ES-1")]
[Obsolete("BinaryFormatter is obsolete")]
public void DoesNotThrowWhenTryToSerializeWithBinaryFormatter()
{
var set = new LinkedHashSet<int> { 1, 10, 5 };
Expand All @@ -120,6 +121,7 @@ public void DoesNotThrowWhenTryToSerializeWithBinaryFormatter()
}

[Test(Description = "ES-1")]
[Obsolete("BinaryFormatter is obsolete")]
public void ShouldBeAbleToDeserializeBinarySerialized()
{
var set = new LinkedHashSet<int> { 1, 10, 5 };
Expand Down
3 changes: 2 additions & 1 deletion src/Iesi.Collections.Test/Generic/ReadOnlySetFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ protected override Type ExpectedType

#if !NETCOREAPP1_0
[Test(Description = "ES-1")]
[Obsolete("BinaryFormatter is obsolete")]
public void ShouldBeAbleToDeserializeBinarySerialized()
{
var set = new ReadOnlySet<int>(new HashSet<int> { 1, 10, 5 });
Expand All @@ -48,4 +49,4 @@ public void ShouldBeAbleToDeserializeBinarySerialized()
#endif

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ protected override ISet<string> CreateInstance(ICollection<string> init)

#if !NETCOREAPP1_0
[Test(Description = "ES-1")]
[Obsolete("BinaryFormatter is obsolete")]
public void ShouldBeAbleToDeserializeBinarySerialized()
{
var set = new SynchronizedSet<int>(new HashSet<int> { 1, 10, 5 });
Expand Down
3 changes: 2 additions & 1 deletion src/Iesi.Collections.Test/Iesi.Collections.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net40;net461;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net40;net461;net8.0</TargetFrameworks>
<Company>NHibernate community</Company>
<Description>The Unit Tests for Iesi.Collections.</Description>
<OutputType>exe</OutputType>
<GenerateProgramFile>false</GenerateProgramFile>
<IsTestProject>true</IsTestProject>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 8bea87a

Please sign in to comment.