Skip to content

Commit 0d4ba66

Browse files
committed
Add .NET 8.0 target
Removed .NET Core 2.0 target Updated AsyncGenerator to 0.22.0 Updated vulnerable packages
1 parent 396d8d9 commit 0d4ba66

File tree

20 files changed

+186
-30
lines changed

20 files changed

+186
-30
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools":{
55
"csharpasyncgenerator.tool": {
6-
"version": "0.21.1",
6+
"version": "0.22.0",
77
"commands": [
88
"async-generator"
99
]

.github/workflows/GenerateAsyncCode.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup .NET
2222
uses: actions/setup-dotnet@v3
2323
with:
24-
dotnet-version: 6.0.x
24+
dotnet-version: 8.0.x
2525

2626
- name: Generate Async code
2727
run: |

.github/workflows/dotnet.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- name: Setup .NET
6868
uses: actions/setup-dotnet@v1
6969
with:
70-
dotnet-version: 6.0.x
70+
dotnet-version: 8.0.x
7171

7272
- name: Compile and run tests
73-
run: dotnet test Src\\Envers.sln -c Release -f net6.0
73+
run: dotnet test Src\\Envers.sln -c Release -f net8.0

Src/AsyncGenerator.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
projects:
22
- filePath: NHibernate.Envers/NHibernate.Envers.csproj
3-
targetFramework: netcoreapp2.0
3+
targetFramework: net8.0
44
concurrentRun: true
55
applyChanges: true
66
analyzation:
@@ -41,7 +41,7 @@ projects:
4141
- type: AsyncGenerator.Core.Plugins.EmptyRegionRemover
4242
assemblyName: AsyncGenerator.Core
4343
- filePath: NHibernate.Envers.Tests/NHibernate.Envers.Tests.csproj
44-
targetFramework: net6.0
44+
targetFramework: net8.0
4545
concurrentRun: true
4646
applyChanges: true
4747
analyzation:

Src/NHibernate.Envers.Tests/Async/Integration/AuditReader/AuditReaderAPITest.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,17 @@ public async Task ShouldAuditAsync()
2828
(await (AuditReader().GetRevisionsAsync(typeof(AuditedTestEntity),1)).ConfigureAwait(false))
2929
.Should().Have.SameSequenceAs(1, 2);
3030
}
31+
32+
[Test]
33+
public void ShouldNotAuditAsync()
34+
{
35+
AuditReader().IsEntityClassAudited(typeof(NotAuditedTestEntity))
36+
.Should().Be.False();
37+
AuditReader().IsEntityNameAudited(typeof(NotAuditedTestEntity).FullName)
38+
.Should().Be.False();
39+
40+
Assert.ThrowsAsync<NotAuditedException>(() =>
41+
AuditReader().GetRevisionsAsync(typeof(NotAuditedTestEntity), 1));
42+
}
3143
}
3244
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by AsyncGenerator.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
10+
11+
using NHibernate.Envers.Exceptions;
12+
using NUnit.Framework;
13+
14+
namespace NHibernate.Envers.Tests.Integration.Basic
15+
{
16+
using System.Threading.Tasks;
17+
public partial class NonVersionedTest : TestBase
18+
{
19+
20+
[Test]
21+
public void VerifyRevisionCountAsync()
22+
{
23+
Assert.ThrowsAsync<NotAuditedException>(() =>
24+
AuditReader().GetRevisionsAsync(typeof(BasicTestEntity3),id1)
25+
);
26+
}
27+
28+
[Test]
29+
public void VerifyHistoryAsync()
30+
{
31+
Assert.ThrowsAsync<NotAuditedException>(() =>
32+
AuditReader().FindAsync<BasicTestEntity3>(id1, 1)
33+
);
34+
}
35+
}
36+
}

Src/NHibernate.Envers.Tests/Async/Integration/Basic/OutsideTransactionTest.cs

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ namespace NHibernate.Envers.Tests.Integration.Basic
2222
public partial class OutsideTransactionTest : TestBase
2323
{
2424

25+
[Test]
26+
public void ShouldThrowIfInsertOutsideActiveTransactionAsync()
27+
{
28+
// Illegal insertion of entity outside of active transaction.
29+
var entity = new StrTestEntity {Str = "data"};
30+
Assert.ThrowsAsync<AuditException>(async () =>
31+
{
32+
await (Session.SaveAsync(entity)).ConfigureAwait(false);
33+
await (Session.FlushAsync()).ConfigureAwait(false);
34+
});
35+
}
36+
2537
[Test]
2638
public async Task ShouldThrowIfUpdateOutsideActiveTransactionAsync()
2739
{
@@ -33,9 +45,9 @@ public async Task ShouldThrowIfUpdateOutsideActiveTransactionAsync()
3345
}
3446
// Illegal modification of entity state outside of active transaction.
3547
entity.Str = "modified data";
36-
Assert.Throws<AuditException>(() => {
37-
Session.Update(entity);
38-
Session.Flush();
48+
Assert.ThrowsAsync<AuditException>(async () => {
49+
await (Session.UpdateAsync(entity)).ConfigureAwait(false);
50+
await (Session.FlushAsync()).ConfigureAwait(false);
3951
});
4052
}
4153

@@ -49,10 +61,10 @@ public async Task ShouldThrowIfDeleteOutsideActiveTransactionAsync()
4961
await (tx.CommitAsync()).ConfigureAwait(false);
5062
}
5163
// Illegal modification of entity state outside of active transaction.
52-
Assert.Throws<AuditException>(() =>
64+
Assert.ThrowsAsync<AuditException>(async () =>
5365
{
54-
Session.Delete(entity);
55-
Session.Flush();
66+
await (Session.DeleteAsync(entity)).ConfigureAwait(false);
67+
await (Session.FlushAsync()).ConfigureAwait(false);
5668
});
5769
}
5870

@@ -69,10 +81,10 @@ public async Task ShouldThrowIfCollectionUpdateOutsideActiveTransactionAsync()
6981
}
7082
// Illegal collection update outside of active transaction.
7183
person.Names.Remove(name);
72-
Assert.Throws<AuditException>(() =>
84+
Assert.ThrowsAsync<AuditException>(async () =>
7385
{
74-
Session.Update(person);
75-
Session.Flush();
86+
await (Session.UpdateAsync(person)).ConfigureAwait(false);
87+
await (Session.FlushAsync()).ConfigureAwait(false);
7688
});
7789
}
7890

@@ -89,10 +101,10 @@ public async Task ShouldThrowIfCollectionRemovalOutsideActiveTransactionAsync()
89101
}
90102
// Illegal collection update outside of active transaction.
91103
person.Names = null;
92-
Assert.Throws<AuditException>(() =>
104+
Assert.ThrowsAsync<AuditException>(async () =>
93105
{
94-
Session.Update(person);
95-
Session.Flush();
106+
await (Session.UpdateAsync(person)).ConfigureAwait(false);
107+
await (Session.FlushAsync()).ConfigureAwait(false);
96108
});
97109
}
98110
}

Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/AllAudited/AbstractAllAuditedTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public async Task VerifyRetrieveNonAuditedAsync()
5151

5252
si.Data.Should().Be.EqualTo(nai.Data);
5353

54-
Assert.Throws<NotAuditedException>(() =>
55-
AuditReader().Find<NonAuditedImplementor>(naiId, 1));
54+
Assert.ThrowsAsync<NotAuditedException>(() =>
55+
AuditReader().FindAsync<NonAuditedImplementor>(naiId, 1));
5656

5757
(await (AuditReader().FindAsync<ISimple>(naiId, 1)).ConfigureAwait(false))
5858
.Should().Be.Null();

Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/PropertiesAudited/AbstractAllAuditedTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public async Task VerifyRetrieveNonAuditedAsync()
4242

4343
si.Data.Should().Be.EqualTo(nai.Data);
4444

45-
Assert.Throws<NotAuditedException>(() =>
46-
AuditReader().Find<NonAuditedImplementor>(naiId, 1));
45+
Assert.ThrowsAsync<NotAuditedException>(() =>
46+
AuditReader().FindAsync<NonAuditedImplementor>(naiId, 1));
4747

4848
(await (AuditReader().FindAsync<ISimple>(naiId, 1)).ConfigureAwait(false))
4949
.Should().Be.Null();

Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/PropertiesAudited2/AbstractAllAuditedTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public async Task VerifyRetrieveNonAuditedAsync()
4242

4343
si.Data.Should().Be.EqualTo(nai.Data);
4444

45-
Assert.Throws<NotAuditedException>(() =>
46-
AuditReader().Find<NonAuditedImplementor>(naiId, 1));
45+
Assert.ThrowsAsync<NotAuditedException>(() =>
46+
AuditReader().FindAsync<NonAuditedImplementor>(naiId, 1));
4747

4848
(await (AuditReader().FindAsync<ISimple>(naiId, 1)).ConfigureAwait(false))
4949
.Should().Be.Null();

0 commit comments

Comments
 (0)