diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 00000000..118ed0a7 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools":{ + "csharpasyncgenerator.tool": { + "version": "0.21.1", + "commands": [ + "async-generator" + ] + } + } +} \ No newline at end of file diff --git a/.github/workflows/GenerateAsyncCode.yml b/.github/workflows/GenerateAsyncCode.yml new file mode 100644 index 00000000..6fe2918a --- /dev/null +++ b/.github/workflows/GenerateAsyncCode.yml @@ -0,0 +1,44 @@ +name: Generate Async code + +on: + pull_request_target: + paths: + - '**.cs' + +permissions: {} + +jobs: + generate-async: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + token: ${{ secrets.NHIBERNATE_BOT_TOKEN }} + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Generate Async code + run: | + pushd Src + dotnet tool restore + dotnet restore ./Envers.sln + dotnet async-generator + popd + + - name: Push changes + run: | + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + if [[ -z "$(git status --porcelain)" ]]; then + echo "No changes to commit" + exit 0 + fi + git add -A + git commit -am "Generate async files" + git push diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9341600e..2785099b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -23,7 +23,7 @@ jobs: - db: MySQL connectionstring: "Server=localhost;Uid=root;Password=envers;Database=envers;SslMode=none;" dialect: "NHibernate.Dialect.MySQL8InnoDBDialect" - driverclass: "NHibernate.Driver.MySqlDataDriver" + driverclass: "NHibernate.Driver.MySqlConnector.MySqlConnectorDriver, NHibernate.Driver.MySqlConnector" - db: Oracle connectionstring: "User ID=envers;Password=envers;Metadata Pooling=false;Self Tuning=false;Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XEPDB1)))" dialect: "NHibernate.Dialect.Oracle10gDialect" @@ -47,7 +47,7 @@ jobs: if: matrix.db == 'MySQL' run: | sudo service mysql stop - docker run --name mysql --tmpfs /var/lib/mysql:rw,noexec,nosuid,size=256m -e MYSQL_ROOT_PASSWORD=envers -e MYSQL_USER=envers -e MYSQL_PASSWORD=envers -e MYSQL_DATABASE=envers -p 3306:3306 --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -d mysql:8.0 mysqld --lower_case_table_names=1 --skip-ssl --default_authentication_plugin=mysql_native_password + docker run --name mysql --tmpfs /var/lib/mysql:rw,noexec,nosuid,size=1024m -e MYSQL_ROOT_PASSWORD=envers -e MYSQL_USER=envers -e MYSQL_PASSWORD=envers -e MYSQL_DATABASE=envers -p 3306:3306 --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -d mysql:8.0 mysqld --lower_case_table_names=1 --skip-ssl --default_authentication_plugin=mysql_native_password - name: Set up Oracle if: matrix.db == 'Oracle' run: | diff --git a/Src/AsyncGenerator.yml b/Src/AsyncGenerator.yml new file mode 100644 index 00000000..e59a1cf2 --- /dev/null +++ b/Src/AsyncGenerator.yml @@ -0,0 +1,73 @@ +projects: +- filePath: NHibernate.Envers\NHibernate.Envers.csproj + targetFramework: netcoreapp2.0 + concurrentRun: true + applyChanges: true + analyzation: + methodConversion: + - conversion: ToAsync + name: Results + containingTypeName: IEntityAuditQuery + - conversion: ToAsync + name: BuildAndExecuteQuery + containingTypeName: AbstractRevisionsQuery + - conversion: ToAsync + name: Results + containingTypeName: AllEntitiesAtRevisionQuery + - conversion: Ignore + containingTypeName: IPropertyMapper + - conversion: Ignore + containingTypeName: CollectionProxy + typeConversion: + - conversion: Ignore + name: Toolz + callForwarding: true + cancellationTokens: + guards: true + methodParameter: + - parameter: Optional + requiresCancellationToken: + - containingTypeName: IEntityAuditQuery + scanMethodBody: true + searchAsyncCounterpartsInInheritedTypes: true + scanForMissingAsyncMembers: + - all: true + alwaysAwait: + - all: true + transformation: + configureAwaitArgument: false + localFunctions: true + registerPlugin: + - type: AsyncGenerator.Core.Plugins.EmptyRegionRemover + assemblyName: AsyncGenerator.Core +- filePath: NHibernate.Envers.Tests\NHibernate.Envers.Tests.csproj + targetFramework: net6.0 + concurrentRun: true + applyChanges: true + analyzation: + callForwarding: true + cancellationTokens: + enabled: true + scanMethodBody: true + searchAsyncCounterpartsInInheritedTypes: true + scanForMissingAsyncMembers: + - all: true + methodConversion: + - conversion: Ignore + name: Initialize + containingTypeName: OneStrategyTestBase + transformation: + configureAwaitArgument: false + localFunctions: true + registerPlugin: + - type: AsyncGenerator.Core.Plugins.NUnitPlugin + parameters: + - name: createNewTypes + value: false + assemblyName: AsyncGenerator.Core + - type: AsyncGenerator.Core.Plugins.TransactionScopeAsyncFlowAdder + assemblyName: AsyncGenerator.Core +methodRules: + - filters: + - containingType: NHibernate.Envers.Synchronization.transactionCompletionProcess + name: TransactionCompletion \ No newline at end of file diff --git a/Src/Build/default.msbuild b/Src/Build/default.msbuild index eb40c949..46340bc8 100644 --- a/Src/Build/default.msbuild +++ b/Src/Build/default.msbuild @@ -20,7 +20,7 @@ - + @@ -37,6 +37,10 @@ + + + + diff --git a/Src/Envers.sln b/Src/Envers.sln index 29bc7e5b..32a28947 100644 --- a/Src/Envers.sln +++ b/Src/Envers.sln @@ -1,15 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2015 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{34BA8295-3EBE-47B0-ABBF-0A7E9A8E6B35}" ProjectSection(SolutionItems) = preProject + AsyncGenerator.yml = AsyncGenerator.yml Build\buildDoc.bat = Build\buildDoc.bat Build\buildRelease.bat = Build\buildRelease.bat Build\default.msbuild = Build\default.msbuild - ReleaseNotes.txt = ReleaseNotes.txt ..\.github\workflows\dotnet.yml = ..\.github\workflows\dotnet.yml + ..\.github\workflows\GenerateAsyncCode.yml = ..\.github\workflows\GenerateAsyncCode.yml + ReleaseNotes.txt = ReleaseNotes.txt EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Doc", "Doc", "{C9C74EFE-506E-41A8-8359-88AB303E60DA}" diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/FieldAccessTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/FieldAccessTest.cs new file mode 100644 index 00000000..0db0fa96 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/FieldAccessTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.AccessType +{ + using System.Threading.Tasks; + public partial class FieldAccessTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(FieldAccessEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new FieldAccessEntity { Id = id }; + ver1.SetData("first"); + var ver2 = new FieldAccessEntity { Id = id }; + ver2.SetData("second"); + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/ImmutableClassAccessTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/ImmutableClassAccessTest.cs new file mode 100644 index 00000000..611591ce --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/ImmutableClassAccessTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.AccessType +{ + using System.Threading.Tasks; + public partial class ImmutableClassAccessTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Country), country.Code)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var country1 = await (Session.GetAsync(country.Code)).ConfigureAwait(false); + Assert.AreEqual(country, country1); + + var history = await (AuditReader().FindAsync(country1.Code, 1)).ConfigureAwait(false); + Assert.AreEqual(country, history); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/MixedAccessTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/MixedAccessTest.cs new file mode 100644 index 00000000..8817f4e6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/MixedAccessTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.AccessType +{ + using System.Threading.Tasks; + public partial class MixedAccessTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(MixedAccessEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new MixedAccessEntity(id1, "data"); + var ver2 = new MixedAccessEntity(id1, "data2"); + + var rev1 = await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false); + + Assert.IsTrue(rev1.IsDataSet); + Assert.IsTrue(rev2.IsDataSet); + + Assert.AreEqual(ver1, rev1); + Assert.AreEqual(ver2, rev2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/NoSetterTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/NoSetterTest.cs new file mode 100644 index 00000000..68f9eaf3 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/NoSetterTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.AccessType +{ + using System.Threading.Tasks; + public partial class NoSetterTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(NoSetterEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var rev1 = await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false); + + Assert.AreEqual("data", rev1.Data); + Assert.AreEqual("data2", rev2.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/PropertyAccessTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/PropertyAccessTest.cs new file mode 100644 index 00000000..45cb0d5a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/AccessType/PropertyAccessTest.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.AccessType +{ + using System.Threading.Tasks; + public partial class PropertyAccessTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(PropertyAccessEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + Assert.AreEqual("first", (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Data); + Assert.AreEqual("second", (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/AuditReader/AuditReaderAPITest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/AuditReader/AuditReaderAPITest.cs new file mode 100644 index 00000000..d2d22396 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/AuditReader/AuditReaderAPITest.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.AuditReader +{ + using System.Threading.Tasks; + public partial class AuditReaderAPITest : TestBase + { + + [Test] + public async Task ShouldAuditAsync() + { + AuditReader().IsEntityClassAudited(typeof (AuditedTestEntity)) + .Should().Be.True(); + AuditReader().IsEntityNameAudited(typeof(AuditedTestEntity).FullName) + .Should().Be.True(); + (await (AuditReader().GetRevisionsAsync(typeof(AuditedTestEntity),1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/ColumnScalePrecisionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/ColumnScalePrecisionTest.cs new file mode 100644 index 00000000..459d93f8 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/ColumnScalePrecisionTest.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class ColumnScalePrecisionTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (ScalePrecisionEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + } + + [Test] + public async Task VerifyHistoryOfScalePrecisionEntityAsync() + { + var ver1 = new ScalePrecisionEntity {Id = id, Number = 13}; + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/DeleteTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/DeleteTest.cs new file mode 100644 index 00000000..2b6a72ac --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/DeleteTest.cs @@ -0,0 +1,58 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class DeleteTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] {1, 2, 4}, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity2),id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] {1, 3}, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity2),id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] {1, 2}, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity2),id3)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ver1 = new BasicTestEntity2 {Id = id1, Str1 = "x"}; + var ver2 = new BasicTestEntity2 {Id = id1, Str1 = "x2"}; + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id1, 4)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var ver1 = new BasicTestEntity2 { Id = id2, Str1 = "y" }; + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id2, 3)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id2, 4)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf3Async() + { + var ver1 = new BasicTestEntity2 { Id = id3, Str1 = "z" }; + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 1)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id3, 2)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id3, 3)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id3, 4)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/EmptyStringTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/EmptyStringTest.cs new file mode 100644 index 00000000..dc629243 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/EmptyStringTest.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Dialect; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class EmptyStringTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (StrTestEntity), emptyId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof (StrTestEntity), nullId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/GlobalVersionedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/GlobalVersionedTest.cs new file mode 100644 index 00000000..b91f5cc1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/GlobalVersionedTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class GlobalVersionedTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity4), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new BasicTestEntity4 { Id = id1, Str1 = "x", Str2 = "y" }; + var ver2 = new BasicTestEntity4 { Id = id1, Str1 = "a", Str2 = "b" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/ManyOperationsInTransactionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/ManyOperationsInTransactionTest.cs new file mode 100644 index 00000000..5bb6d7d6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/ManyOperationsInTransactionTest.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class ManyOperationsInTransactionTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity1), id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity1), id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity1), id3)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ver1 = new BasicTestEntity1 { Id = id1, Str1 = "x", Long1 = 1 }; + var ver2 = new BasicTestEntity1 { Id = id1, Str1 = "x2", Long1 = 1 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var ver1 = new BasicTestEntity1 { Id = id2, Str1 = "y", Long1 = 20 }; + var ver2 = new BasicTestEntity1 { Id = id2, Str1 = "y", Long1 = 21 }; + var ver3 = new BasicTestEntity1 { Id = id2, Str1 = "y3", Long1 = 22 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id2, 3)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf3Async() + { + var ver1 = new BasicTestEntity1 { Id = id3, Str1 = "z", Long1 = 300 }; + var ver2 = new BasicTestEntity1 { Id = id3, Str1 = "z3", Long1 = 300 }; + + Assert.IsNull(await (AuditReader().FindAsync(id3, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id3, 3)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/NullPropertiesTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/NullPropertiesTest.cs new file mode 100644 index 00000000..428f0c17 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/NullPropertiesTest.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class NullPropertiesTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity1), id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity1), id2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ver1 = new BasicTestEntity1 { Id = id1, Str1 = "x", Long1 = 1 }; + var ver2 = new BasicTestEntity1 { Id = id1, Long1 = 1 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 4)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var ver1 = new BasicTestEntity1 { Id = id2, Long1 = 20 }; + var ver2 = new BasicTestEntity1 { Id = id2, Str1 = "y2", Long1 = 20 }; + + Assert.IsNull(await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id2, 4)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/OutsideTransactionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/OutsideTransactionTest.cs new file mode 100644 index 00000000..af6d2ff1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/OutsideTransactionTest.cs @@ -0,0 +1,99 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Transactions; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Integration.Collection.NoRevision; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class OutsideTransactionTest : TestBase + { + + [Test] + public async Task ShouldThrowIfUpdateOutsideActiveTransactionAsync() + { + var entity = new StrTestEntity { Str = "data" }; + using (var tx = Session.BeginTransaction()) + { + await (Session.SaveAsync(entity)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + // Illegal modification of entity state outside of active transaction. + entity.Str = "modified data"; + Assert.Throws(() => { + Session.Update(entity); + Session.Flush(); + }); + } + + [Test] + public async Task ShouldThrowIfDeleteOutsideActiveTransactionAsync() + { + var entity = new StrTestEntity { Str = "data" }; + using (var tx = Session.BeginTransaction()) + { + await (Session.SaveAsync(entity)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + // Illegal modification of entity state outside of active transaction. + Assert.Throws(() => + { + Session.Delete(entity); + Session.Flush(); + }); + } + + [Test] + public async Task ShouldThrowIfCollectionUpdateOutsideActiveTransactionAsync() + { + var person = new Person(); + var name = new Name {TheName = "Name"}; + person.Names.Add(name); + using (var tx = Session.BeginTransaction()) + { + await (Session.SaveAsync(person)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + // Illegal collection update outside of active transaction. + person.Names.Remove(name); + Assert.Throws(() => + { + Session.Update(person); + Session.Flush(); + }); + } + + [Test] + public async Task ShouldThrowIfCollectionRemovalOutsideActiveTransactionAsync() + { + var person = new Person(); + var name = new Name {TheName = "Name"}; + person.Names.Add(name); + using (var tx = Session.BeginTransaction()) + { + await (Session.SaveAsync(person)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + // Illegal collection update outside of active transaction. + person.Names = null; + Assert.Throws(() => + { + Session.Update(person); + Session.Flush(); + }); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/SimpleTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/SimpleTest.cs new file mode 100644 index 00000000..e2808beb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/SimpleTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class SimpleTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(IntTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new IntTestEntity { Id = id1, Number = 10 }; + var ver2 = new IntTestEntity { Id = id1, Number = 20 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(typeof(IntTestEntity),id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/SingleOperationInTransactionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/SingleOperationInTransactionTest.cs new file mode 100644 index 00000000..2ed2e5d1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/SingleOperationInTransactionTest.cs @@ -0,0 +1,82 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using NHibernate.Envers.Exceptions; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class SingleOperationInTransactionTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 4, 6 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity1), id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 5, 7 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity1), id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 3 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity1), id3)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ver1 = new BasicTestEntity1 { Id = id1, Str1 = "x", Long1 = 1 }; + var ver2 = new BasicTestEntity1 { Id = id1, Str1 = "x2", Long1 = 2 }; + var ver3 = new BasicTestEntity1 { Id = id1, Str1 = "x3", Long1 = 3 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 4)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 5)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id1, 6)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id1, 7)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var ver1 = new BasicTestEntity1 { Id = id2, Str1 = "y", Long1 = 20 }; + var ver2 = new BasicTestEntity1 { Id = id2, Str1 = "y2", Long1 = 20 }; + var ver3 = new BasicTestEntity1 { Id = id2, Str1 = "y3", Long1 = 21 }; + + Assert.IsNull(await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 4)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id2, 5)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id2, 6)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id2, 7)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf3Async() + { + var ver1 = new BasicTestEntity1 { Id = id3, Str1 = "z", Long1 = 30 }; + + Assert.IsNull(await (AuditReader().FindAsync(id3, 1)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id3, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 4)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 5)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 6)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 7)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfNonExistingEntityAsync() + { + Assert.IsNull(await (AuditReader().FindAsync(id1 + id2 + id3, 1)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id1 + id2 + id3, 7)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/TransactionRollbackBehaviourTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/TransactionRollbackBehaviourTest.cs new file mode 100644 index 00000000..4418c5c0 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/TransactionRollbackBehaviourTest.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class TransactionRollbackBehaviourTest : TestBase + { + + [Test] + public async Task CommittedEntityShouldHaveAuditRecordAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(IntTestEntity), committedId)).ConfigureAwait(false)).Count().Should().Be.EqualTo(1); + } + + [Test] + public async Task RollbackedEntityShouldHaveAuditRecordIfPersistedAsync() + { + //NH might persist rollbacked entity + //https://nhibernate.jira.com/browse/NH-3304 + var revisions = await (AuditReader().GetRevisionsAsync(typeof (IntTestEntity), rollbackId)).ConfigureAwait(false); + var entity = await (Session.GetAsync(rollbackId)).ConfigureAwait(false); + if (entity == null) + { + revisions.Should().Be.Empty(); + } + else + { + //if code generated poid, the session is still dirty when second transaction starts + // eg oracle dialects ends up here in this test + revisions.Count().Should().Be.EqualTo(1); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/UnversionedPropertiesChangeTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/UnversionedPropertiesChangeTest.cs new file mode 100644 index 00000000..1b2de40b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/UnversionedPropertiesChangeTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class UnversionedPropertiesChangeTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BasicTestEntity2), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ver1 = new BasicTestEntity2 { Id = id1, Str1 = "x"}; + var ver2 = new BasicTestEntity2 { Id = id1, Str1 = "y"}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Basic/UnversionedPropertyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/UnversionedPropertyTest.cs new file mode 100644 index 00000000..643719fd --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Basic/UnversionedPropertyTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Basic +{ + using System.Threading.Tasks; + public partial class UnversionedPropertyTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2}, await (AuditReader().GetRevisionsAsync(typeof(UnversionedEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ver1 = new UnversionedEntity { Id = id1, Str1 = "a1" }; + var ver2 = new UnversionedEntity { Id = id1, Str1 = "a2" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Cache/OneToManyCacheTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Cache/OneToManyCacheTest.cs new file mode 100644 index 00000000..8e440b37 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Cache/OneToManyCacheTest.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Cache +{ + using System.Threading.Tasks; + public partial class OneToManyCacheTest : TestBase + { + + [Test] + public async Task VerifyCacheReferenceAfterFindAsync() + { + var ed1_rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var ing1_rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var ing2_rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + + Assert.AreSame(ing1_rev1.Reference, ed1_rev1); + Assert.AreSame(ing2_rev1.Reference, ed1_rev1); + + } + + [Test] + public async Task VerifyCacheReferenceAccessAfterCollectionAccessRev1Async() + { + var ed1_rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + Assert.AreEqual(2, ed1_rev1.Reffering.Count); + foreach (var setRefIngEntity in ed1_rev1.Reffering) + { + Assert.AreSame(setRefIngEntity.Reference, ed1_rev1); + } + } + + [Test] + public async Task VerifyCacheReferenceAccessAfterCollectionAccessRev2Async() + { + var ed1_rev2 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + Assert.AreEqual(2, ed1_rev2.Reffering.Count); + foreach (var setRefIngEntity in ed1_rev2.Reffering) + { + Assert.AreSame(setRefIngEntity.Reference, ed1_rev2); + } + } + + [Test] + public async Task VerifyCacheFindAfterCollectionAccessRev1Async() + { + var ed1_rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + + // Reading the collection + Assert.AreEqual(2, ed1_rev1.Reffering.Count); + + var ing1_rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var ing2_rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + foreach (var setRefIngEntity in ed1_rev1.Reffering) + { + if (setRefIngEntity == ing1_rev1 || setRefIngEntity == ing2_rev1) + continue; + Assert.Fail(); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Cache/OneToOneCacheTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Cache/OneToOneCacheTest.cs new file mode 100644 index 00000000..a7c33b08 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Cache/OneToOneCacheTest.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Cache +{ + using System.Threading.Tasks; + public partial class OneToOneCacheTest : TestBase + { + + [Test] + public async Task VerifyCacheReferenceAccessAfterFindRev1Async() + { + var ed1_rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var ing1_rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + + Assert.AreSame(ing1_rev1.Reference, ed1_rev1); + } + + [Test] + public async Task VerifyCacheReferenceAccessAfterFindRev2Async() + { + var ed2_rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var ing1_rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + + Assert.AreSame(ing1_rev2.Reference, ed2_rev2); + } + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Cache/QueryCacheTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Cache/QueryCacheTest.cs new file mode 100644 index 00000000..2c213bd8 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Cache/QueryCacheTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Cache +{ + using System.Threading.Tasks; + public partial class QueryCacheTest : TestBase + { + + [Test] + public async Task VerifyCacheFindAfterRevisionOfEntityQueryAsync() + { + var entsFromQuery = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (IntTestEntity), true, false) + .GetResultListAsync()).ConfigureAwait(false); + + var entFromFindRev1 = await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false); + var entFromFindRev2 = await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false); + + Assert.AreSame(entFromFindRev1, entsFromQuery[0]); + Assert.AreSame(entFromFindRev2, entsFromQuery[1]); + } + + [Test] + public async Task VerifyCacheFindAfterEntitiesAtRevisionQueryAsync() + { + var entFromQuery = (IntTestEntity) await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof (IntTestEntity), 1) + .GetSingleResultAsync()).ConfigureAwait(false); + var entFromFind = await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false); + Assert.AreSame(entFromFind, entFromQuery); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/BasicEmbeddableCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/BasicEmbeddableCollectionTest.cs new file mode 100644 index 00000000..7aff257c --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/BasicEmbeddableCollectionTest.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable +{ + using System.Threading.Tasks; + public partial class BasicEmbeddableCollectionTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (DarkCharacter), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3, 4, 5); + } + + [Test] + public async Task VerifyHistoryOfCharacterAsync() + { + var darkCharacter = new DarkCharacter {Id = id, Kills = 1}; + var ver1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + ver1.Should().Be.EqualTo(darkCharacter); + ver1.Names.Should().Be.Empty(); + + darkCharacter.Names.Add(new Name { FirstName = "Action", LastName = "Hank" }); + var ver2 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + ver2.Should().Be.EqualTo(darkCharacter); + ver2.Names.Should().Have.SameValuesAs(darkCharacter.Names); + + darkCharacter.Names.Add(new Name { FirstName = "Green", LastName = "Lantern" }); + var ver3 = await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false); + ver3.Should().Be.EqualTo(darkCharacter); + ver3.Names.Should().Have.SameValuesAs(darkCharacter.Names); + + darkCharacter.Names.Remove(new Name { FirstName = "Action", LastName = "Hank" }); + var ver4 = await (AuditReader().FindAsync(id, 4)).ConfigureAwait(false); + ver4.Should().Be.EqualTo(darkCharacter); + ver4.Names.Should().Have.SameValuesAs(darkCharacter.Names); + + darkCharacter.Names.Clear(); + var ver5 = await (AuditReader().FindAsync(id, 5)).ConfigureAwait(false); + ver5.Should().Be.EqualTo(darkCharacter); + ver5.Names.Should().Have.SameValuesAs(darkCharacter.Names); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableList1Test.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableList1Test.cs new file mode 100644 index 00000000..52ce57f3 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableList1Test.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Entities.Components; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable +{ + using System.Threading.Tasks; + public partial class EmbeddableList1Test : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (EmbeddableListEntity1), ele1Id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3, 4); + } + + [Test] + public async Task VerifyHistoryOfEle1Async() + { + var rev1 = await (AuditReader().FindAsync(ele1Id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ele1Id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ele1Id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ele1Id, 4)).ConfigureAwait(false); + + rev1.ComponentList.Should().Have.SameSequenceAs(c3_1); + rev2.ComponentList.Should().Have.SameSequenceAs(c3_1, c3_2); + rev3.ComponentList.Should().Have.SameSequenceAs(c3_1, c3_2, c3_1); + rev4.ComponentList.Should().Have.SameSequenceAs(c3_1, c3_1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableList2Test.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableList2Test.cs new file mode 100644 index 00000000..9e458c10 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableList2Test.cs @@ -0,0 +1,85 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Entities.Components.Relations; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable +{ + using System.Threading.Tasks; + public partial class EmbeddableList2Test : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (EmbeddableListEntity2), eleId1)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2, 3, 4, 5, 7, 8); + (await (AuditReader().GetRevisionsAsync(typeof (StrTestNoProxyEntity), entity1.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof (StrTestNoProxyEntity), entity2.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof (StrTestNoProxyEntity), entity3.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(4); + (await (AuditReader().GetRevisionsAsync(typeof (StrTestNoProxyEntity), entity4.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(5, 6); + } + + [Test] + public async Task VerifyManyToOneComponentListAsync() + { + // Revision 1: many-to-one component1 in the list + var rev1 = await (AuditReader().FindAsync(eleId1, 1)).ConfigureAwait(false); + rev1.Should().Not.Be.Null(); + rev1.ComponentList.Should().Not.Be.Empty(); + rev1.ComponentList[0].Data.Should().Be.EqualTo("dataComponent1"); + rev1.ComponentList[0].Entity.Should().Be.EqualTo(entity1); + } + + [Test] + public async Task VerifyHistoryOfEle1Async() + { + // Revision 1: many-to-one component in the list + (await (AuditReader().FindAsync(eleId1, 1)).ConfigureAwait(false)).ComponentList + .Should().Have.SameSequenceAs(new ManyToOneEagerComponent {Data = "dataComponent1", Entity = entity1}); + + // Revision 2: many-to-one component in the list + (await (AuditReader().FindAsync(eleId1, 2)).ConfigureAwait(false)).ComponentList + .Should().Have.SameSequenceAs(new ManyToOneEagerComponent { Data = "dataComponent2", Entity = entity2 }); + + // Revision 3: two many-to-one components in the list + (await (AuditReader().FindAsync(eleId1, 3)).ConfigureAwait(false)).ComponentList + .Should().Have.SameSequenceAs(new ManyToOneEagerComponent { Data = "dataComponent2", Entity = entity2 }, + new ManyToOneEagerComponent{Data="dataComponent1", Entity = entity1}); + + // Revision 4: second component edited and first one in the list + (await (AuditReader().FindAsync(eleId1, 4)).ConfigureAwait(false)).ComponentList + .Should().Have.SameSequenceAs(new ManyToOneEagerComponent { Data = "dataComponent3", Entity = entity3 }, + new ManyToOneEagerComponent { Data = "dataComponent1", Entity = entity1 }); + + // Revision 5: fourth component added in the list + (await (AuditReader().FindAsync(eleId1, 5)).ConfigureAwait(false)).ComponentList + .Should().Have.SameSequenceAs(new ManyToOneEagerComponent { Data = "dataComponent3", Entity = entity3 }, + new ManyToOneEagerComponent { Data = "dataComponent1", Entity = entity1 }, + new ManyToOneEagerComponent { Data = "dataComponent4", Entity = entity4Copy }); + + // Revision 6: changing fourth component property + (await (AuditReader().FindAsync(eleId1, 6)).ConfigureAwait(false)).ComponentList + .Should().Have.SameSequenceAs(new ManyToOneEagerComponent { Data = "dataComponent3", Entity = entity3 }, + new ManyToOneEagerComponent { Data = "dataComponent1", Entity = entity1 }, + new ManyToOneEagerComponent { Data = "dataComponent4", Entity = entity4 }); + + // Revision 7: removing component number four + (await (AuditReader().FindAsync(eleId1, 7)).ConfigureAwait(false)).ComponentList + .Should().Have.SameSequenceAs(new ManyToOneEagerComponent { Data = "dataComponent3", Entity = entity3 }, + new ManyToOneEagerComponent { Data = "dataComponent1", Entity = entity1 }); + + (await (AuditReader().FindAsync(eleId1, 8)).ConfigureAwait(false)).Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableMapTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableMapTest.cs new file mode 100644 index 00000000..1f7cb342 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableMapTest.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Entities.Components; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable +{ + using System.Threading.Tasks; + public partial class EmbeddableMapTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(EmbeddableMapEntity), eme1Id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3); + (await (AuditReader().GetRevisionsAsync(typeof(EmbeddableMapEntity), eme2Id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 3); + } + + [Test] + public async Task VerifyHistoryOfEme1Async() + { + var rev1 = await (AuditReader().FindAsync(eme1Id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(eme1Id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(eme1Id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(eme1Id, 4)).ConfigureAwait(false); + + rev1.ComponentMap.Should().Be.Empty(); + rev2.ComponentMap.Should().Have.SameValuesAs(new KeyValuePair("1", c3_1), new KeyValuePair("2", c3_2)); + rev3.ComponentMap.Should().Have.SameValuesAs(new KeyValuePair("2", c3_2)); + rev4.ComponentMap.Should().Have.SameValuesAs(new KeyValuePair("2", c3_2)); + } + + [Test] + public async Task VerifyHistoryOfEme2Async() + { + var rev1 = await (AuditReader().FindAsync(eme2Id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(eme2Id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(eme2Id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(eme2Id, 4)).ConfigureAwait(false); + + + rev1.ComponentMap.Should().Have.SameValuesAs(new KeyValuePair("1", c3_1)); + rev2.ComponentMap.Should().Have.SameValuesAs(new KeyValuePair("1", c3_1)); + rev3.ComponentMap.Should().Have.SameValuesAs(new KeyValuePair("1", c3_2)); + rev4.ComponentMap.Should().Have.SameValuesAs(new KeyValuePair("1", c3_2)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableSetTest.cs new file mode 100644 index 00000000..a8d9f396 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/Embeddable/EmbeddableSetTest.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Entities.Components; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable +{ + using System.Threading.Tasks; + public partial class EmbeddableSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (EmbeddableSetEntity), ese1Id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3, 4, 5, 6, 7); + } + + [Test] + public async Task VerifyHistoryOfEse1Async() + { + var rev1 = await (AuditReader().FindAsync(ese1Id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ese1Id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ese1Id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ese1Id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ese1Id, 5)).ConfigureAwait(false); + var rev6 = await (AuditReader().FindAsync(ese1Id, 6)).ConfigureAwait(false); + var rev7 = await (AuditReader().FindAsync(ese1Id, 7)).ConfigureAwait(false); + + rev1.ComponentSet.Should().Have.SameValuesAs(c3_1, c3_3); + rev2.ComponentSet.Should().Have.SameValuesAs(c3_1, c3_2, c3_3); + rev3.ComponentSet.Should().Have.SameValuesAs(c3_1, c3_3); + rev4.ComponentSet.Should().Have.SameValuesAs(c3_1, c3_2, c3_3, c3_4); + rev5.ComponentSet.Should().Have.SameValuesAs(c3_1, c3_3); + rev6.ComponentSet.Should().Have.SameValuesAs(c3_2, c3_4); + rev7.ComponentSet.Should().Have.SameValuesAs(c3_2, c3_4, c3_1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/EnumSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/EnumSetTest.cs new file mode 100644 index 00000000..9f0675d7 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/EnumSetTest.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Collection +{ + using System.Threading.Tasks; + public partial class EnumSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(EnumSetEntity), sse1_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfAsync() + { + var rev1 = await (AuditReader().FindAsync(sse1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(sse1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(sse1_id, 3)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { E1.X }, rev1.Enums1); + CollectionAssert.AreEquivalent(new[] { E1.X, E1.Y }, rev2.Enums1); + CollectionAssert.AreEquivalent(new[] { E1.Y }, rev3.Enums1); + + CollectionAssert.AreEquivalent(new[] { E2.A }, rev1.Enums2); + CollectionAssert.AreEquivalent(new[] { E2.A }, rev2.Enums2); + CollectionAssert.AreEquivalent(new[] { E2.A }, rev3.Enums2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/MapKey/ComponentMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/MapKey/ComponentMapKeyTest.cs new file mode 100644 index 00000000..2e7dfcbd --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/MapKey/ComponentMapKeyTest.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Components; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Collection.MapKey +{ + using System.Threading.Tasks; + public partial class ComponentMapKeyTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ComponentMapKeyEntity), cmke_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfImkeAsync() + { + var cte1 = await (Session.GetAsync(cte1_id)).ConfigureAwait(false); + var cte2 = await (Session.GetAsync(cte2_id)).ConfigureAwait(false); + + // These fields are unversioned. + cte1.Comp2 = null; + cte2.Comp2 = null; + + var rev1 = await (AuditReader().FindAsync(cmke_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(cmke_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(new Dictionary { { cte1.Comp1, cte1 } }, rev1.IdMap); + Assert.AreEqual(new Dictionary { { cte1.Comp1, cte1 }, { cte2.Comp1, cte2 } }, rev2.IdMap); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/MapKey/IdMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/MapKey/IdMapKeyTest.cs new file mode 100644 index 00000000..317c2f7f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/MapKey/IdMapKeyTest.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Collection.MapKey +{ + using System.Threading.Tasks; + public partial class IdMapKeyTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(IdMapKeyEntity), imke_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfImkeAsync() + { + var ste1 = await (Session.GetAsync(ste1_id)).ConfigureAwait(false); + var ste2 = await (Session.GetAsync(ste2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(imke_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(imke_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(new Dictionary { { ste1.Id, ste1 } }, rev1.IdMap); + Assert.AreEqual(new Dictionary { { ste1.Id, ste1 }, { ste2.Id, ste2 } }, rev2.IdMap); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/NoRevision/AbstractCollectionChangeTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/NoRevision/AbstractCollectionChangeTest.cs new file mode 100644 index 00000000..9eac9ca8 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/NoRevision/AbstractCollectionChangeTest.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Collection.NoRevision +{ + using System.Threading.Tasks; + public abstract partial class AbstractCollectionChangeTest : TestBase + { + + [Test] + public async Task VerifyPersonRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Person),PersonId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(ExpectedPersonRevisions); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringListTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringListTest.cs new file mode 100644 index 00000000..99a44316 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringListTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Collection +{ + using System.Threading.Tasks; + public partial class StringListTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(StringListEntity), sle1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(StringListEntity), sle2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var rev1 = await (AuditReader().FindAsync(sle1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(sle1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(sle1_id, 3)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Strings); + CollectionAssert.AreEqual(new[] { "sle1_string1", "sle1_string2" }, rev2.Strings); + CollectionAssert.AreEqual(new[] { "sle1_string3", "sle1_string2" }, rev3.Strings); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var rev1 = await (AuditReader().FindAsync(sle2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(sle2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(sle2_id, 3)).ConfigureAwait(false); + + CollectionAssert.AreEqual(new[] { "sle2_string1", "sle2_string2" }, rev1.Strings); + CollectionAssert.AreEqual(new[] { "sle2_string1", "sle2_string2", "sle2_string1" }, rev2.Strings); + CollectionAssert.AreEqual(new[] { "sle2_string2", "sle2_string1" }, rev3.Strings); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringMapTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringMapTest.cs new file mode 100644 index 00000000..58e3e3ac --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringMapTest.cs @@ -0,0 +1,57 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Tests.Entities.Collection; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Collection +{ + using System.Threading.Tasks; + public partial class StringMapTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(StringMapEntity), sme1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(StringMapEntity), sme2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var rev1 = await (AuditReader().FindAsync(sme1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(sme1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(sme1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(sme1_id, 4)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Strings.Keys); + Assert.AreEqual(new Dictionary { { "1", "a" }, { "2", "b" } }, rev2.Strings.OrderBy(kv => kv.Key)); + Assert.AreEqual(new Dictionary { { "2", "b" } }, rev3.Strings); + Assert.AreEqual(new Dictionary { { "2", "b" } }, rev4.Strings); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var rev1 = await (AuditReader().FindAsync(sme2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(sme2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(sme2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(sme2_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(new Dictionary { { "1", "a" } }, rev1.Strings); + Assert.AreEqual(new Dictionary { { "1", "a" } }, rev2.Strings); + Assert.AreEqual(new Dictionary { { "1", "b" } }, rev3.Strings); + Assert.AreEqual(new Dictionary { { "1", "b" } }, rev4.Strings); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringSetTest.cs new file mode 100644 index 00000000..ca9e4fcb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Collection/StringSetTest.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Collection +{ + using System.Threading.Tasks; + public partial class StringSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StringSetEntity), sse1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(StringSetEntity), sse2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var rev1 = await (AuditReader().FindAsync(sse1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(sse1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(sse1_id, 3)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Strings); + CollectionAssert.AreEquivalent(new[] { "sse1_string1", "sse1_string2" }, rev2.Strings); + CollectionAssert.AreEquivalent(new[] { "sse1_string1", "sse1_string2" }, rev3.Strings); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var rev1 = await (AuditReader().FindAsync(sse2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(sse2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(sse2_id, 3)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { "sse2_string1", "sse2_string2" }, rev1.Strings); + CollectionAssert.AreEquivalent(new[] { "sse2_string1", "sse2_string2" }, rev2.Strings); + CollectionAssert.AreEquivalent(new[] { "sse2_string2" }, rev3.Strings); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Components/Collections/CollectionOfComponentsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Components/Collections/CollectionOfComponentsTest.cs new file mode 100644 index 00000000..a71d2d14 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Components/Collections/CollectionOfComponentsTest.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Components; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Components.Collections +{ + using System.Threading.Tasks; + public partial class CollectionOfComponentsTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEqual(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ComponentSetTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)).Comps); + + var comps1 = (await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)).Comps; + Assert.AreEqual(1, comps1.Count); + CollectionAssert.Contains(comps1, new Component1 { Str1 = "a", Str2 = "b" }); + } + + [Test] + public async Task VerifyCollectionOfEmbeddableWithNullValueAsync() + { + var componentV1 = new Component1 {Str1 = "string1", Str2 = null}; + var entityV1 = await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false); + + entityV1.Comps.Should().Have.SameSequenceAs(componentV1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Components/ComponentsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Components/ComponentsTest.cs new file mode 100644 index 00000000..1d11f14b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Components/ComponentsTest.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Components; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Components +{ + using System.Threading.Tasks; + public partial class ComponentsTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEqual(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ComponentTestEntity), id1)).ConfigureAwait(false)); + CollectionAssert.AreEqual(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ComponentTestEntity), id2)).ConfigureAwait(false)); + CollectionAssert.AreEqual(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ComponentTestEntity), id3)).ConfigureAwait(false)); + CollectionAssert.AreEqual(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ComponentTestEntity), id4)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ver1 = new ComponentTestEntity { Id = id1, Comp1 = new Component1 { Str1 = "a", Str2 = "b" } }; + var ver2 = new ComponentTestEntity { Id = id1, Comp1 = new Component1 { Str1 = "a'", Str2 = "b'" } }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 4)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var ver1 = new ComponentTestEntity { Id = id2, Comp1 = new Component1 { Str1 = "a2", Str2 = "b2" } }; + var ver2 = new ComponentTestEntity { Id = id2, Comp1 = new Component1 { Str1 = "a2'", Str2 = "b2" } }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id2, 3)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id2, 4)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf3Async() + { + var ver1 = new ComponentTestEntity { Id = id3, Comp1 = new Component1 { Str1 = "a3", Str2 = "b3" } }; + var ver2 = new ComponentTestEntity { Id = id3, Comp1 = new Component1 { Str1 = "a3", Str2 = "b3'" } }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id3, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id3, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id3, 4)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf4Async() + { + var ver1 = new ComponentTestEntity { Id = id4 }; + var ver2 = new ComponentTestEntity { Id = id4, Comp1 = new Component1 { Str1 = "n" } }; + var ver3 = new ComponentTestEntity { Id = id4 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id4, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id4, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id4, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id4, 4)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Components/DefaultValueComponentsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Components/DefaultValueComponentsTest.cs new file mode 100644 index 00000000..86e73fbb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Components/DefaultValueComponentsTest.cs @@ -0,0 +1,111 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Components; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Components +{ + using System.Threading.Tasks; + public partial class DefaultValueComponentsTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (DefaultValueComponentTestEntity), id0)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof (DefaultValueComponentTestEntity), id1)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof (DefaultValueComponentTestEntity), id2)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof (DefaultValueComponentTestEntity), id3)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof (DefaultValueComponentTestEntity), id4)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof (DefaultValueComponentTestEntity), id5)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof (DefaultValueComponentTestEntity), id6)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryOfId0Async() + { + var ent1 = await (AuditReader().FindAsync(id0, 1)).ConfigureAwait(false); + var ent2 = await (AuditReader().FindAsync(id0, 2)).ConfigureAwait(false); + var expectedVer1 = new DefaultValueComponentTestEntity {Id = id0, Comp1 = new DefaultValueComponent1{Str1 = null, Comp2 = null}}; + var expectedVer2 = new DefaultValueComponentTestEntity { Id = id0, Comp1 = new DefaultValueComponent1 { Str1 = "upd-c1-str1", Comp2 = null } }; + ent1.Should().Be.EqualTo(expectedVer1); + ent2.Should().Be.EqualTo(expectedVer2); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ent1 = await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false); + var ent2 = await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false); + var expectedVer1 = new DefaultValueComponentTestEntity { Id = id1, Comp1 = new DefaultValueComponent1 { Str1 = "c1-str1", Comp2 = null } }; + var expectedVer2 = new DefaultValueComponentTestEntity { Id = id1, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "upd-c2-str1", Str2 = "upd-c2-str2" } } }; + ent1.Should().Be.EqualTo(expectedVer1); + ent2.Should().Be.EqualTo(expectedVer2); + } + + [Test] + public async Task VerifyHistoryOfId2Async() + { + var ent1 = await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false); + var ent2 = await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false); + var expectedVer1 = new DefaultValueComponentTestEntity { Id = id2, Comp1 = new DefaultValueComponent1 { Str1 = "c1-str1", Comp2 = new DefaultValueComponent2 { Str1 = "c2-str1", Str2 = "c2-str2" } } }; + var expectedVer2 = new DefaultValueComponentTestEntity { Id = id2, Comp1 = new DefaultValueComponent1 { Str1 = "c1-str1", Comp2 = new DefaultValueComponent2 { Str1 = "upd-c2-str1", Str2 = "c2-str2" } } }; + ent1.Should().Be.EqualTo(expectedVer1); + ent2.Should().Be.EqualTo(expectedVer2); + } + + [Test] + public async Task VerifyHistoryOfId3Async() + { + var ent1 = await (AuditReader().FindAsync(id3, 1)).ConfigureAwait(false); + var ent2 = await (AuditReader().FindAsync(id3, 2)).ConfigureAwait(false); + var expectedVer1 = new DefaultValueComponentTestEntity { Id = id3, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "c2-str1", Str2 = "c2-str2" } } }; + var expectedVer2 = new DefaultValueComponentTestEntity { Id = id3, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "upd-c2-str1", Str2 = "c2-str2" } } }; + ent1.Should().Be.EqualTo(expectedVer1); + ent2.Should().Be.EqualTo(expectedVer2); + } + + [Test] + public async Task VerifyHistoryOfId4Async() + { + var ent1 = await (AuditReader().FindAsync(id4, 1)).ConfigureAwait(false); + var ent2 = await (AuditReader().FindAsync(id4, 2)).ConfigureAwait(false); + var expectedVer1 = new DefaultValueComponentTestEntity { Id = id4, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = null, Str2 = "c2-str2" } } }; + var expectedVer2 = new DefaultValueComponentTestEntity { Id = id4, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "upd-c2-str1", Str2 = "c2-str2" } } }; + ent1.Should().Be.EqualTo(expectedVer1); + ent2.Should().Be.EqualTo(expectedVer2); + } + + [Test] + public async Task VerifyHistoryOfId5Async() + { + var ent1 = await (AuditReader().FindAsync(id5, 1)).ConfigureAwait(false); + var ent2 = await (AuditReader().FindAsync(id5, 2)).ConfigureAwait(false); + var expectedVer1 = new DefaultValueComponentTestEntity { Id = id5, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "c2-str1", Str2 = null } } }; + var expectedVer2 = new DefaultValueComponentTestEntity { Id = id5, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "upd-c2-str1", Str2 = null } } }; + ent1.Should().Be.EqualTo(expectedVer1); + ent2.Should().Be.EqualTo(expectedVer2); + } + + [Test] + public async Task VerifyHistoryOfId6Async() + { + var ent1 = await (AuditReader().FindAsync(id6, 1)).ConfigureAwait(false); + var ent2 = await (AuditReader().FindAsync(id6, 2)).ConfigureAwait(false); + var expectedVer1 = new DefaultValueComponentTestEntity { Id = id6, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = null } }; + var expectedVer2 = new DefaultValueComponentTestEntity { Id = id6, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "upd-c2-str1", Str2 = null } } }; + ent1.Should().Be.EqualTo(expectedVer1); + ent2.Should().Be.EqualTo(expectedVer2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Components/PropertiesGroupTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Components/PropertiesGroupTest.cs new file mode 100644 index 00000000..1258d73d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Components/PropertiesGroupTest.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Components; +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Components +{ + using System.Threading.Tasks; + public partial class PropertiesGroupTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfUniquePropsEntityAsync() + { + var expected = new UniquePropsEntity {Id = auditedId, Data1 = "data1", Data2 = "data2"}; + (await (AuditReader().FindAsync(auditedId, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(expected); + } + + [Test] + public async Task VerifyHistoryOfUniquePropsNotAuditedEntityAsync() + { + var expected = new UniquePropsNotAuditedEntity { Id = notAuditedId, Data1 = "data3"}; + (await (AuditReader().FindAsync(notAuditedId, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(expected); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/ManyToOneInComponentTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/ManyToOneInComponentTest.cs new file mode 100644 index 00000000..491f9422 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/ManyToOneInComponentTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Components.Relations; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Components.Relations +{ + using System.Threading.Tasks; + public partial class ManyToOneInComponentTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEqual(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ManyToOneComponentTestEntity), mtocte_id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ste1 = await (Session.GetAsync(ste_id1)).ConfigureAwait(false); + var ste2 = await (Session.GetAsync(ste_id2)).ConfigureAwait(false); + + var ver2 = new ManyToOneComponentTestEntity { Id = mtocte_id1, Comp1 = new ManyToOneComponent{Entity = ste1, Data = "data1" } }; + var ver3 = new ManyToOneComponentTestEntity { Id = mtocte_id1, Comp1 = new ManyToOneComponent{Entity = ste2, Data = "data1" } }; + + Assert.IsNull(await (AuditReader().FindAsync(mtocte_id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(mtocte_id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(mtocte_id1, 3)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/NotAuditedManyToOneInComponentTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/NotAuditedManyToOneInComponentTest.cs new file mode 100644 index 00000000..47d49ed1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/NotAuditedManyToOneInComponentTest.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Components.Relations; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Components.Relations +{ + using System.Threading.Tasks; + public partial class NotAuditedManyToOneInComponentTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEqual(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(NotAuditedManyToOneComponentTestEntity), mtocte_id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new NotAuditedManyToOneComponentTestEntity + {Id = mtocte_id1, Comp1 = new NotAuditedManyToOneComponent {Data = "data1"}}; + var ver2 = new NotAuditedManyToOneComponentTestEntity + {Id = mtocte_id1, Comp1 = new NotAuditedManyToOneComponent {Data = "data2"}}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(mtocte_id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(mtocte_id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/OneToManyInComponentTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/OneToManyInComponentTest.cs new file mode 100644 index 00000000..205eb1e2 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Components/Relations/OneToManyInComponentTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Components.Relations; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Components.Relations +{ + using System.Threading.Tasks; + public partial class OneToManyInComponentTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEqual(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(OneToManyComponentTestEntity), otmcte_id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ste1 = await (Session.GetAsync(ste_id1)).ConfigureAwait(false); + var ste2 = await (Session.GetAsync(ste_id2)).ConfigureAwait(false); + + var ver2 = new OneToManyComponentTestEntity {Id = otmcte_id1, Comp1 = new OneToManyComponent {Data = "data1"}}; + ver2.Comp1.Entities.Add(ste1); + var ver3 = new OneToManyComponentTestEntity {Id = otmcte_id1, Comp1 = new OneToManyComponent {Data = "data1"}}; + ver3.Comp1.Entities.Add(ste1); + ver3.Comp1.Entities.Add(ste2); + + Assert.IsNull(await (AuditReader().FindAsync(otmcte_id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(otmcte_id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(otmcte_id1, 3)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/CompositeCustomTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/CompositeCustomTest.cs new file mode 100644 index 00000000..f1404405 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/CompositeCustomTest.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.CustomType; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.CustomType +{ + using System.Threading.Tasks; + public partial class CompositeCustomTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(CompositeCustomTypeEntity), ccte_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfCccteAsync() + { + var rev1 = await (AuditReader().FindAsync(ccte_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ccte_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ccte_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(rev1.Component, new Component {Prop1 = "a", Prop2 = 1}); + Assert.AreEqual(rev2.Component, new Component {Prop1 = "b", Prop2 = 1}); + Assert.AreEqual(rev3.Component, new Component {Prop1 = "c", Prop2 = 3}); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/ParametrizedCustomTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/ParametrizedCustomTest.cs new file mode 100644 index 00000000..0babdc74 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/ParametrizedCustomTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.CustomType; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.CustomType +{ + using System.Threading.Tasks; + public partial class ParametrizedCustomTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ParametrizedCustomTypeEntity), pcte_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfPcteAsync() + { + var rev1 = await (AuditReader().FindAsync(pcte_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(pcte_id, 2)).ConfigureAwait(false); + + Assert.AreEqual("xUy", rev1.Str); + Assert.AreEqual("xVy", rev2.Str); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/PrimitiveCustomTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/PrimitiveCustomTest.cs new file mode 100644 index 00000000..b14089db --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/CustomType/PrimitiveCustomTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.CustomType; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.CustomType +{ + using System.Threading.Tasks; + public partial class PrimitiveCustomTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(PrimitiveCustomTypeEntity), pctec_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfPctecAsync() + { + var rev1 = await (AuditReader().FindAsync(pctec_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(pctec_id, 2)).ConfigureAwait(false); + + Assert.AreEqual('u', rev1.PrimitiveType.CharValue); + Assert.AreEqual('v', rev2.PrimitiveType.CharValue); + } + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Data/DateTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Data/DateTest.cs new file mode 100644 index 00000000..2dfb7f69 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Data/DateTest.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Data +{ + using System.Threading.Tasks; + public partial class DateTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(DateTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new DateTestEntity {Id = id1, Date = new DateTime(2000,1,2,3,4,5)}; + var ver2 = new DateTestEntity { Id = id1, Date = new DateTime(2001,2,3,4,5,6) }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Data/EnumTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Data/EnumTest.cs new file mode 100644 index 00000000..d2bdd639 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Data/EnumTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Data +{ + using System.Threading.Tasks; + public partial class EnumTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(EnumTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new EnumTestEntity {Id = id1, Enum1 = E1.X, Enum2 = E2.A}; + var ver2 = new EnumTestEntity {Id = id1, Enum1 = E1.Y, Enum2 = E2.B}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Data/LobsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Data/LobsTest.cs new file mode 100644 index 00000000..4b572b50 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Data/LobsTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Data +{ + using System.Threading.Tasks; + public partial class LobsTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(LobTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new LobTestEntity { Id = id1, StringLob = "abc", ByteLob = new byte[] { 0, 1, 2 } }; + var ver2 = new LobTestEntity { Id = id1, StringLob = "def", ByteLob = new byte[] { 3, 4, 5 } }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Data/SerializableTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Data/SerializableTest.cs new file mode 100644 index 00000000..a9054f32 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Data/SerializableTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Data +{ + using System.Threading.Tasks; + public partial class SerializableTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(SerializableTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new SerializableTestEntity { Id = id1, Obj = new SerObj { Data = "d1" } }; + var ver2 = new SerializableTestEntity { Id = id1, Obj = new SerObj { Data = "d2" } }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/AuditedEntity/ReadEntityWithEntityNameTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/AuditedEntity/ReadEntityWithEntityNameTest.cs new file mode 100644 index 00000000..472a40a6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/AuditedEntity/ReadEntityWithEntityNameTest.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.EntityNames.AuditedEntity +{ + using System.Threading.Tasks; + public partial class ReadEntityWithEntityNameTest : TestBase + { + + [Test] + public async Task ShouldRetrieveRevisionsWithEntityNameAsync() + { + var pers1Revs = await (AuditReader().GetRevisionsAsync("Personaje", id_pers1)).ConfigureAwait(false); + var pers2Revs = await (AuditReader().GetRevisionsAsync("Personaje", id_pers2)).ConfigureAwait(false); + var pers3Revs = await (AuditReader().GetRevisionsAsync("Personaje", id_pers3)).ConfigureAwait(false); + + pers1Revs.Should().Have.Count.EqualTo(3); + pers2Revs.Should().Have.Count.EqualTo(2); + pers3Revs.Should().Have.Count.EqualTo(1); + } + + [Test] + public async Task ShouldRetrieveAuditedEntityWithEntityNameAsync() + { + (await (AuditReader().FindAsync("Personaje", id_pers1, 1)).ConfigureAwait(false)).Should().Not.Be.Null(); + (await (AuditReader().FindAsync("Personaje", id_pers1, 2)).ConfigureAwait(false)).Should().Not.Be.Null(); + (await (AuditReader().FindAsync("Personaje", id_pers1, 3)).ConfigureAwait(false)).Should().Not.Be.Null(); + } + + [Test] + public async Task ShouldObtainEntityNameAuditedEntityWithEntityNameAsync() + { + var person1_1 = await (AuditReader().FindAsync("Personaje", id_pers1, 1)).ConfigureAwait(false); + var person1_2 = await (AuditReader().FindAsync("Personaje", id_pers1, 2)).ConfigureAwait(false); + var person1_3 = await (AuditReader().FindAsync("Personaje", id_pers1, 3)).ConfigureAwait(false); + + var person1EN = AuditReader().GetEntityName(id_pers1, 1, person1_1); + var person2EN = AuditReader().GetEntityName(id_pers1, 2, person1_2); + var person3EN = AuditReader().GetEntityName(id_pers1, 3, person1_3); + + person1EN.Should().Be.EqualTo("Personaje"); + person2EN.Should().Be.EqualTo("Personaje"); + person3EN.Should().Be.EqualTo("Personaje"); + } + + [Test] + public async Task ShouldRetrieveAuditedEntityWithEntityNameWithNewSessionAsync() + { + ForceNewSession(); + + (await (AuditReader().FindAsync("Personaje", id_pers1, 1)).ConfigureAwait(false)).Should().Not.Be.Null(); + (await (AuditReader().FindAsync("Personaje", id_pers1, 2)).ConfigureAwait(false)).Should().Not.Be.Null(); + (await (AuditReader().FindAsync("Personaje", id_pers1, 3)).ConfigureAwait(false)).Should().Not.Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/ManyToManyAudited/ReadEntityWithAuditedManyToManyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/ManyToManyAudited/ReadEntityWithAuditedManyToManyTest.cs new file mode 100644 index 00000000..5e52def1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/ManyToManyAudited/ReadEntityWithAuditedManyToManyTest.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.EntityNames.ManyToManyAudited +{ + using System.Threading.Tasks; + using System.Threading; + public partial class ReadEntityWithAuditedManyToManyTest : TestBase + { + + private async Task loadDataOnSessionAndAuditReaderAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + car1_2 = await (AuditReader().FindAsync(id_car1, 2, cancellationToken)).ConfigureAwait(false); + var car2_2 = await (AuditReader().FindAsync(id_car2, 2, cancellationToken)).ConfigureAwait(false); + + // navigate through relations to load objects + foreach (var foo in from owner in car1_2.Owners from car in owner.Cars select car.Number) + { + } + foreach (var foo in from owner in car2_2.Owners from car in owner.Cars select car.Number) + { + } + + car1 = await (Session.GetAsync(id_car1, cancellationToken)).ConfigureAwait(false); + person1_1 = (Person) await (AuditReader().FindAsync("Personaje", id_pers1, 1, cancellationToken)).ConfigureAwait(false); + } + + private async Task checkEntityNamesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + AuditReader().GetEntityName(id_pers1, 1, person1_1) + .Should().Be.EqualTo("Personaje"); + AuditReader().GetEntityName(id_car1, 2, car1_2) + .Should().Be.EqualTo(await (Session.GetEntityNameAsync(car1, cancellationToken)).ConfigureAwait(false)); + } + + [Test] + public async Task ShouldGetEntityNameManyToManyWithEntityNameAsync() + { + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + + [Test] + public async Task ShouldGetEntityNameManyToManyWithEntityNameInNewSessionAsync() + { + ForceNewSession(); + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/OneToManyAudited/ReadEntityWithAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/OneToManyAudited/ReadEntityWithAuditedCollectionTest.cs new file mode 100644 index 00000000..6405744b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/OneToManyAudited/ReadEntityWithAuditedCollectionTest.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.EntityNames.OneToManyAudited +{ + using System.Threading.Tasks; + using System.Threading; + public partial class ReadEntityWithAuditedCollectionTest : TestBase + { + + private async Task loadDataOnSessionAndAuditReaderAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + person1_1 = (Person)await (AuditReader().FindAsync("Personaje", id_pers1, 1, cancellationToken)).ConfigureAwait(false); + car1_1 = await (AuditReader().FindAsync(id_car1, 2, cancellationToken)).ConfigureAwait(false); + var car2 = await (AuditReader().FindAsync(id_car2, 2, cancellationToken)).ConfigureAwait(false); + + // navigate through relations to load objects + foreach (var foo in car1_1.Owners.Select(owner => owner.Name)) + { + } + foreach (var foo in car2.Owners.Select(owner => owner.Name)) + { + } + } + + private async Task checkEntityNamesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + AuditReader().GetEntityName(id_car1, 2, car1_1) + .Should().Be.EqualTo(await (Session.GetEntityNameAsync(await (Session.GetAsync(id_car1, cancellationToken)).ConfigureAwait(false), cancellationToken)).ConfigureAwait(false)); + AuditReader().GetEntityName(id_pers1, 1, person1_1) + .Should().Be.EqualTo("Personaje"); + } + + [Test] + public async Task ShouldObtainEntityNameAuditedCollectionWithEntityNameAsync() + { + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + + [Test] + public async Task ShouldObtainEntityNameAuditedCollectionWithEntityNameInNewSessionAsync() + { + ForceNewSession(); + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/OneToManyNotAudited/ReadEntityWithAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/OneToManyNotAudited/ReadEntityWithAuditedCollectionTest.cs new file mode 100644 index 00000000..ddbb36f5 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/OneToManyNotAudited/ReadEntityWithAuditedCollectionTest.cs @@ -0,0 +1,58 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.EntityNames.OneToManyNotAudited +{ + using System.Threading.Tasks; + using System.Threading; + public partial class ReadEntityWithAuditedCollectionTest : TestBase + { + + private async Task loadDataOnSessionAndAuditReaderAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + car1_1 = await (AuditReader().FindAsync(id_car1, 2, cancellationToken)).ConfigureAwait(false); + var car2 = await (AuditReader().FindAsync(id_car2, 2, cancellationToken)).ConfigureAwait(false); + + // navigate through relations to load objects + foreach (var foo in car1_1.Owners.Select(owner => owner.Name)) + { + } + foreach (var foo in car2.Owners.Select(owner => owner.Name)) + { + } + } + + private async Task checkEntityNamesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + AuditReader().GetEntityName(id_car1, 2, car1_1) + .Should().Be.EqualTo(await (Session.GetEntityNameAsync(await (Session.GetAsync(id_car1, cancellationToken)).ConfigureAwait(false), cancellationToken)).ConfigureAwait(false)); + } + + [Test] + public async Task ShouldObtainEntityNameAuditedCollectionWithEntityNameAsync() + { + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + + [Test] + public async Task ShouldObtainEntityNameAuditedCollectionWithEntityNameInNewSessionAsync() + { + ForceNewSession(); + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedAudited/ReadEntityAssociatedAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedAudited/ReadEntityAssociatedAuditedTest.cs new file mode 100644 index 00000000..9de8d851 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedAudited/ReadEntityAssociatedAuditedTest.cs @@ -0,0 +1,64 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.EntityNames.SingleAssociatedAudited +{ + using System.Threading.Tasks; + using System.Threading; + public partial class ReadEntityAssociatedAuditedTest : TestBase + { + + private async Task loadDataOnSessionAndAuditReaderAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + currentCar1 = await (Session.GetAsync(id_car1, cancellationToken)).ConfigureAwait(false); + currentPerson1 = (Person) await (Session.GetAsync("Personaje", id_pers1, cancellationToken)).ConfigureAwait(false); + car1 = await (AuditReader().FindAsync(id_car1, 1, cancellationToken)).ConfigureAwait(false); + person1 = car1.Owner; + } + + private async Task checkEntitiesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + currentPerson1.Age.Should().Not.Be.EqualTo(person1.Age); + + var person2 = (Person)await (Session.GetAsync("Personaje", id_pers2, cancellationToken)).ConfigureAwait(false); + var car2 = await (AuditReader().FindAsync(id_car2, 2, cancellationToken)).ConfigureAwait(false); + var person2_1 = car2.Owner; + person2.Age.Should().Be.EqualTo(person2_1.Age); + } + + private async Task checkEntityNamesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + AuditReader().GetEntityName(id_car1, 1, car1) + .Should().Be.EqualTo(await (Session.GetEntityNameAsync(currentCar1, cancellationToken)).ConfigureAwait(false)); + AuditReader().GetEntityName(id_pers1, 1, person1) + .Should().Be.EqualTo("Personaje"); + } + + [Test] + public async Task ShouldGetAssociationWithEntityNameAsync() + { + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntitiesAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + + [Test] + public async Task ShouldGetAssociationWithEntityNameInNewSessionAsync() + { + ForceNewSession(); + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntitiesAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedAudited/SingleDomainObjectToMultipleTablesTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedAudited/SingleDomainObjectToMultipleTablesTest.cs new file mode 100644 index 00000000..9eefb13d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedAudited/SingleDomainObjectToMultipleTablesTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.EntityNames.SingleAssociatedAudited +{ + using System.Threading.Tasks; + public partial class SingleDomainObjectToMultipleTablesTest : TestBase + { + + [Test] + public async Task VerifySingleDomainObjectToMultipleTablesMappingAsync() + { + var carVer1 = await (AuditReader().FindAsync(carId, 1)).ConfigureAwait(false); + var ownerVer1 = (Person)await (AuditReader().FindAsync("Personaje", ownerId, 1)).ConfigureAwait(false); + var driverVer1 = (Person)await (AuditReader().FindAsync("Driveraje", driverId, 1)).ConfigureAwait(false); + + carVer1.Owner.Id.Should().Be.EqualTo(ownerVer1.Id); + carVer1.Driver.Id.Should().Be.EqualTo(driverVer1.Id); + + ownerVer1.Name.Should().Be.EqualTo("Lukasz"); + driverVer1.Name.Should().Be.EqualTo("Kinga"); + carVer1.Number.Should().Be.EqualTo(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedNotAudited/ReadEntityAssociatedNotAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedNotAudited/ReadEntityAssociatedNotAuditedTest.cs new file mode 100644 index 00000000..2b45f040 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/EntityNames/SingleAssociatedNotAudited/ReadEntityAssociatedNotAuditedTest.cs @@ -0,0 +1,55 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.EntityNames.SingleAssociatedNotAudited +{ + using System.Threading.Tasks; + using System.Threading; + public partial class ReadEntityAssociatedNotAuditedTest : TestBase + { + + private async Task loadDataOnSessionAndAuditReaderAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + currentPerson1 = (Person)await (Session.GetAsync("Personaje", id_pers1, cancellationToken)).ConfigureAwait(false); + person2 = (Person) await (Session.GetAsync("Personaje", id_pers2, cancellationToken)).ConfigureAwait(false); + + currentCar1 = await (Session.GetAsync(id_car1, cancellationToken)).ConfigureAwait(false); + + car1 = await (AuditReader().FindAsync(id_car1, 1, cancellationToken)).ConfigureAwait(false); + car2 = await (AuditReader().FindAsync(id_car2, 2, cancellationToken)).ConfigureAwait(false); + } + + private async Task checkEntityNamesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + AuditReader().GetEntityName(id_car1, 1, car1) + .Should().Be.EqualTo(await (Session.GetEntityNameAsync(currentCar1, cancellationToken)).ConfigureAwait(false)); + } + + [Test] + public async Task ShouldObtainEntityNameAssociationWithEntityNameAndNotAuditedModeAsync() + { + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + checkEntities(); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + + [Test] + public async Task ShouldtestObtainEntityNameAssociationWithEntityNameAndNotAuditedModeInNewSessionAsync() + { + ForceNewSession(); + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + checkEntities(); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushAddDelTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushAddDelTest.cs new file mode 100644 index 00000000..a8c58a4c --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushAddDelTest.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Flush +{ + using System.Threading.Tasks; + public partial class DoubleFlushAddDelTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.IsEmpty(await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + Assert.IsNull(await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushAddModTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushAddModTest.cs new file mode 100644 index 00000000..0d018857 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushAddModTest.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Flush +{ + using System.Threading.Tasks; + public partial class DoubleFlushAddModTest :TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new StrTestEntity { Id = id, Str = "y"}; + var ver2 = new StrTestEntity { Id = id, Str = "z" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyRevisionTypesAsync() + { + //rk - avoid casting to ilist. generics? + var results = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id)) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(RevisionType.Added, ((IList)results[0])[2]); + Assert.AreEqual(RevisionType.Modified, ((IList)results[1])[2]); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushModDelTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushModDelTest.cs new file mode 100644 index 00000000..858206b5 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushModDelTest.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Flush +{ + using System.Threading.Tasks; + public partial class DoubleFlushModDelTest :TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x"}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyRevisionTypesAsync() + { + //rk - avoid casting to ilist. generics? + var results = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id)) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(RevisionType.Added, ((IList)results[0])[2]); + Assert.AreEqual(RevisionType.Deleted, ((IList)results[1])[2]); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushModModTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushModModTest.cs new file mode 100644 index 00000000..f845c725 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/DoubleFlushModModTest.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Flush +{ + using System.Threading.Tasks; + public partial class DoubleFlushModModTest :TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x"}; + var ver2 = new StrTestEntity { Id = id, Str = "z" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyRevisionTypesAsync() + { + //rk - avoid casting to ilist. generics? + var results = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id)) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(RevisionType.Added, ((IList)results[0])[2]); + Assert.AreEqual(RevisionType.Modified, ((IList)results[1])[2]); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Flush/ManualFlushTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/ManualFlushTest.cs new file mode 100644 index 00000000..7a76ea92 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Flush/ManualFlushTest.cs @@ -0,0 +1,57 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Flush +{ + using System.Threading.Tasks; + public partial class ManualFlushTest :TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x"}; + var ver2 = new StrTestEntity { Id = id, Str = "z" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyCurrentAsync() + { + var expected = new StrTestEntity {Id = id, Str = "z"}; + Assert.AreEqual(expected, await (Session.GetAsync(id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyRevisionTypesAsync() + { + var results = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id)) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(RevisionType.Added, ((IList)results[0])[2]); + Assert.AreEqual(RevisionType.Modified, ((IList)results[1])[2]); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Generated/GeneratedColumnTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Generated/GeneratedColumnTest.cs new file mode 100644 index 00000000..ad272152 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Generated/GeneratedColumnTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Generated +{ + using System.Threading.Tasks; + public partial class GeneratedColumnTest : TestBase + { + + [Test] + public async Task GetRevisionCountsAsync() + { + Assert.AreEqual(3, (await (AuditReader().GetRevisionsAsync(typeof(SimpleEntity), entityId)).ConfigureAwait(false)).Count()); + } + + [Test] + public async Task TestRevisionHistoryAsync() + { + // revision - insertion + SimpleEntity rev1 = await (AuditReader().FindAsync(entityId, 1)).ConfigureAwait(false); + Assert.AreEqual("data", rev1.Data); + Assert.AreEqual(1, rev1.CaseNumberInsert); + + // revision - update + SimpleEntity rev2 = await (AuditReader().FindAsync(entityId, 2)).ConfigureAwait(false); + Assert.AreEqual("data2", rev2.Data); + Assert.AreEqual(1, rev2.CaseNumberInsert); + + // revision - deletion + SimpleEntity rev3 = await (AuditReader().FindAsync(entityId, 3)).ConfigureAwait(false); + Assert.AreEqual("data2", rev2.Data); + Assert.AreEqual(1, rev2.CaseNumberInsert); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/HashCode/ChangingHashcodeTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/HashCode/ChangingHashcodeTest.cs new file mode 100644 index 00000000..c4d1bdbc --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/HashCode/ChangingHashcodeTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.HashCode +{ + using System.Threading.Tasks; + public partial class ChangingHashcodeTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(WikiPage), pageId)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(WikiImage), imageId)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfImageAsync() + { + Assert.IsNull(await (AuditReader().FindAsync(imageId, 1)).ConfigureAwait(false)); + Assert.AreEqual(new WikiImage{Name="name1"}, await (AuditReader().FindAsync(imageId, 2)).ConfigureAwait(false)); + Assert.AreEqual(new WikiImage{Name="name2"}, await (AuditReader().FindAsync(imageId, 3)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfPageAsync() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(pageId, 1)).ConfigureAwait(false)).Images); + CollectionAssert.AreEquivalent((await (AuditReader().FindAsync(pageId, 2)).ConfigureAwait(false)).Images, new[]{new WikiImage{Name="name1"}}); + CollectionAssert.AreEquivalent((await (AuditReader().FindAsync(pageId, 3)).ConfigureAwait(false)).Images, new[]{new WikiImage{Name="name2"}}); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Ids/CompositeDateIdTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Ids/CompositeDateIdTest.cs new file mode 100644 index 00000000..a7e0c0bb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Ids/CompositeDateIdTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Ids; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Ids +{ + using System.Threading.Tasks; + public partial class CompositeDateIdTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (CompositeDateIdTestEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Str1 + .Should().Be.EqualTo("x"); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).Str1 + .Should().Be.EqualTo("y"); + } + + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Ids/CompositeIdTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Ids/CompositeIdTest.cs new file mode 100644 index 00000000..8c484ba4 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Ids/CompositeIdTest.cs @@ -0,0 +1,88 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Ids; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Ids +{ + using System.Threading.Tasks; + public partial class CompositeIdTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(EmbIdTestEntity), id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3, 4, 5 }, await (AuditReader().GetRevisionsAsync(typeof(EmbIdTestEntity), id2)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(EmbIdWithCustomTypeTestEntity), id5)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(EmbIdWithCustomTypeTestEntity), id6)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new EmbIdTestEntity { Id = id1, Str1 = "x" }; + var ver2 = new EmbIdTestEntity { Id = id1, Str1 = "x2" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id1, 4)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id1, 5)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryOfId2Async() + { + var ver1 = new EmbIdTestEntity { Id = id2, Str1 = "y" }; + var ver2 = new EmbIdTestEntity { Id = id2, Str1 = "y2" }; + var ver3 = new EmbIdTestEntity { Id = id2, Str1 = "y3" }; + + Assert.IsNull(await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id2, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id2, 4)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id2, 5)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId5Async() + { + var ver1 = new EmbIdWithCustomTypeTestEntity { Id = id5, Str1 = "c" }; + var ver2 = new EmbIdWithCustomTypeTestEntity { Id = id5, Str1 = "c2" }; + var ver3 = new EmbIdWithCustomTypeTestEntity { Id = id5, Str1 = "c3" }; + + (await (AuditReader().FindAsync(id5, 1)).ConfigureAwait(false)).Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(id5, 2)).ConfigureAwait(false)).Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(id5, 3)).ConfigureAwait(false)).Should().Be.EqualTo(ver2); + (await (AuditReader().FindAsync(id5, 4)).ConfigureAwait(false)).Should().Be.EqualTo(ver3); + (await (AuditReader().FindAsync(id5, 5)).ConfigureAwait(false)).Should().Be.EqualTo(ver3); + } + + [Test] + public async Task VerifyHistoryOfId6Async() + { + var ver1 = new EmbIdWithCustomTypeTestEntity { Id = id6, Str1 = "d" }; + var ver2 = new EmbIdWithCustomTypeTestEntity { Id = id6, Str1 = "d2" }; + + (await (AuditReader().FindAsync(id6, 1)).ConfigureAwait(false)).Should().Be.Null(); + (await (AuditReader().FindAsync(id6, 2)).ConfigureAwait(false)).Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(id6, 3)).ConfigureAwait(false)).Should().Be.EqualTo(ver2); + (await (AuditReader().FindAsync(id6, 4)).ConfigureAwait(false)).Should().Be.Null(); + (await (AuditReader().FindAsync(id6, 5)).ConfigureAwait(false)).Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Ids/DateIdTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Ids/DateIdTest.cs new file mode 100644 index 00000000..a5a1e857 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Ids/DateIdTest.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Ids; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Ids +{ + using System.Threading.Tasks; + public partial class DateIdTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(DateIdTestEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Str1 + .Should().Be.EqualTo("x"); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).Str1 + .Should().Be.EqualTo("y"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Ids/EmbeddedId/RelationInsideEmbeddableTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Ids/EmbeddedId/RelationInsideEmbeddableTest.cs new file mode 100644 index 00000000..3e403363 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Ids/EmbeddedId/RelationInsideEmbeddableTest.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Ids.EmbeddedId +{ + using System.Threading.Tasks; + public partial class RelationInsideEmbeddableTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (PurchaseOrder), orderId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof (Item), itemId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 3); + } + + [Test] + public async Task VerifyHistoryOfPurchaseOrderAsync() + { + var item = new Item + { + Id = new ItemId {Model = "TV", Producer = new Producer {Id = 1, Name = "Sony"}, Version = 1}, + Price = 100.5 + }; + (await (AuditReader().FindAsync(orderId, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(new PurchaseOrder {Id = orderId, Item = item}); + (await (AuditReader().FindAsync(orderId, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(new PurchaseOrder {Id = orderId, Item = item, Comment = "fragile"}); + } + + [Test] + public async Task VerifyHistoryOfItemAsync() + { + (await (AuditReader().FindAsync(itemId, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(new Item {Id = itemId, Price = 100.5}); + (await (AuditReader().FindAsync(itemId, 3)).ConfigureAwait(false)) + .Should().Be.EqualTo(new Item { Id = itemId, Price = 110 }); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildAuditingTest.cs new file mode 100644 index 00000000..2c3cde27 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildAuditingTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined +{ + using System.Threading.Tasks; + public partial class ChildAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ChildEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + var ver1 = new ChildEntity { Id = id1, Data = "x", Number = 1 }; + var ver2 = new ChildEntity { Id = id1, Data = "y", Number = 2 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var childVersion1 = new ChildEntity { Id = id1, Data = "x", Number = 1 }; + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ChildEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryGenericAsync() + { + var childVersion1 = new ChildEntity { Id = id1, Data = "x", Number = 1 }; + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1).SingleAsync()).ConfigureAwait(false)).Should().Be(childVersion1); + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1).SingleAsync()).ConfigureAwait(false)).Should().Be(childVersion1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildNullAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildNullAuditingTest.cs new file mode 100644 index 00000000..4303c7dd --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildNullAuditingTest.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined +{ + using System.Threading.Tasks; + public partial class ChildNullAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ChildEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + var ver1 = new ChildEntity { Id = id1, Data = "x"}; + var ver2 = new ChildEntity { Id = id1, Number = 2 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var childVersion1 = new ChildEntity { Id = id1, Data = "x", Number = null }; + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ChildEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildRelation/ChildReferencingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildRelation/ChildReferencingTest.cs new file mode 100644 index 00000000..2cd1f1da --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ChildRelation/ChildReferencingTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.ChildRelation +{ + using System.Threading.Tasks; + public partial class ChildReferencingTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToChildEntity), re_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToChildEntity), re_id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ChildIngEntity), c_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollection1Async() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id1, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ChildIngEntity{Id = c_id, Data = "y", Number = 1 }}, (await (AuditReader().FindAsync(re_id1, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id1, 3)).ConfigureAwait(false)).Referencing); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollection2Async() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id2, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id2, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ChildIngEntity { Id = c_id, Data = "y", Number = 1 } }, (await (AuditReader().FindAsync(re_id2, 3)).ConfigureAwait(false)).Referencing); + } + + [Test] + public async Task VerifyChildHistoryAsync() + { + Assert.IsNull(await (AuditReader().FindAsync(c_id, 1)).ConfigureAwait(false)); + Assert.AreEqual(new ReferencedToChildEntity { Id = re_id1 }, (await (AuditReader().FindAsync(c_id, 2)).ConfigureAwait(false)).Referenced); + Assert.AreEqual(new ReferencedToChildEntity { Id = re_id2 }, (await (AuditReader().FindAsync(c_id, 3)).ConfigureAwait(false)).Referenced); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/EmptyChild/EmptyChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/EmptyChild/EmptyChildAuditingTest.cs new file mode 100644 index 00000000..a66aeff1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/EmptyChild/EmptyChildAuditingTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.EmptyChild +{ + using System.Threading.Tasks; + public partial class EmptyChildAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(EmptyChildEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildId1Async() + { + var ver1 = new EmptyChildEntity { Id = id1, Data = "x" }; + var ver2 = new EmptyChildEntity { Id = id1, Data = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var childVer1 = new EmptyChildEntity { Id = id1, Data = "x" }; + + Assert.AreEqual(childVer1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(EmptyChildEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + Assert.AreEqual(childVer1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/NotOwnedRelation/NotOwnBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/NotOwnedRelation/NotOwnBidirectionalTest.cs new file mode 100644 index 00000000..ae62a56e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/NotOwnedRelation/NotOwnBidirectionalTest.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.NotOwnedRelation +{ + using System.Threading.Tasks; + public partial class NotOwnBidirectionalTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(Contact), pc_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(PersonalContact), pc_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Address), a1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(Address), a2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfContactAsync() + { + CollectionAssert.AreEquivalent(new[] {new Address{Id = a1_id, Address1 = "a1"}}, + (await (AuditReader().FindAsync(pc_id, 1)).ConfigureAwait(false)).Addresses); + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" }, new Address { Id = a2_id, Address1 = "a2" } }, + (await (AuditReader().FindAsync(pc_id, 2)).ConfigureAwait(false)).Addresses); + } + + [Test] + public async Task VerifyHistoryOfPersonalContactAsync() + { + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" } }, + (await (AuditReader().FindAsync(pc_id, 1)).ConfigureAwait(false)).Addresses); + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" }, new Address { Id = a2_id, Address1 = "a2" } }, + (await (AuditReader().FindAsync(pc_id, 2)).ConfigureAwait(false)).Addresses); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ParentAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ParentAuditingTest.cs new file mode 100644 index 00000000..51f817d1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/ParentAuditingTest.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined +{ + using System.Threading.Tasks; + public partial class ParentAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + Assert.IsNull(await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + var ver1 = new ParentEntity { Id = id1, Data = "x" }; + var ver2 = new ParentEntity { Id = id1, Data = "y"}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var childVersion1 = new ParentEntity { Id = id1, Data = "x" }; + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + CollectionAssert.IsEmpty(await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ChildEntity), 1).GetResultListAsync()).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/PrimaryKeyJoin/ChildPrimaryKeyJoinAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/PrimaryKeyJoin/ChildPrimaryKeyJoinAuditingTest.cs new file mode 100644 index 00000000..ba80ad39 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/PrimaryKeyJoin/ChildPrimaryKeyJoinAuditingTest.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NHibernate.Envers.Configuration.Attributes; +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.PrimaryKeyJoin +{ + using System.Threading.Tasks; + public partial class ChildPrimaryKeyJoinAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] {1, 2}, await (AuditReader().GetRevisionsAsync(typeof(ChildPrimaryKeyJoinEntity),id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + var ver1 = new ChildPrimaryKeyJoinEntity {Id = id1, Data = "x", Number = 1}; + var ver2 = new ChildPrimaryKeyJoinEntity {Id = id1, Data = "y", Number = 2}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var ver1 = new ChildPrimaryKeyJoinEntity {Id = id1, Data = "x", Number = 1}; + Assert.AreEqual(ver1, + await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof (ChildPrimaryKeyJoinEntity), 1). + GetSingleResultAsync()).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof (ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryGenericAsync() + { + var ver1 = new ChildPrimaryKeyJoinEntity { Id = id1, Data = "x", Number = 1 }; + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1).SingleAsync()).ConfigureAwait(false)).Should().Be(ver1); + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1).SingleAsync()).ConfigureAwait(false)).Should().Be(ver1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/ParentReferencingChildTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/ParentReferencingChildTest.cs new file mode 100644 index 00000000..131b8e8c --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/ParentReferencingChildTest.cs @@ -0,0 +1,76 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.Relation +{ + using System.Threading.Tasks; + public partial class ParentReferencingChildTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Person),expLukaszRev1.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2, 3); + (await (AuditReader().GetRevisionsAsync(typeof(RightsSubject),expLukaszRev1.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2, 3); + + (await (AuditReader().GetRevisionsAsync(typeof(Person),expAdamRev4.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(4, 5, 6); + (await (AuditReader().GetRevisionsAsync(typeof(RightsSubject),expAdamRev4.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(4, 5, 6); + + (await (AuditReader().GetRevisionsAsync(typeof(Role),expAdminRev1.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2, 5); + (await (AuditReader().GetRevisionsAsync(typeof(RightsSubject),expAdminRev1.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2, 5); + + (await (AuditReader().GetRevisionsAsync(typeof(Role),expDirectorRev3.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(3, 4); + (await (AuditReader().GetRevisionsAsync(typeof(RightsSubject),expDirectorRev3.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(3, 4); + } + + [Test] + public async Task VerifyHistoryOfAdamAsync() + { + var adamRev4 = await (AuditReader().FindAsync(expAdamRev4.Id, 4)).ConfigureAwait(false); + var rightsSubject5 = await (AuditReader().FindAsync(expAdamRev4.Id, 5)).ConfigureAwait(false); + + adamRev4.Should().Be.EqualTo(expAdamRev4); + adamRev4.Roles.Should().Have.SameValuesAs(expDirectorRev3); + rightsSubject5.Roles.Should().Have.SameValuesAs(expDirectorRev3, expAdminRev2); + } + + [Test] + public async Task VerifyHistoryOfLukaszAsync() + { + var lukaszRev1 = await (AuditReader().FindAsync(expLukaszRev1.Id, 1)).ConfigureAwait(false); + var lukaszRev2 = await (AuditReader().FindAsync(expLukaszRev1.Id, 2)).ConfigureAwait(false); + var rightsSubject3 = await (AuditReader().FindAsync(expLukaszRev1.Id, 3)).ConfigureAwait(false); + var lukaszRev3 = await (AuditReader().FindAsync(expLukaszRev1.Id, 3)).ConfigureAwait(false); + + lukaszRev1.Should().Be.EqualTo(expLukaszRev1); + lukaszRev2.Should().Be.EqualTo(expLukaszRev2); + lukaszRev1.Roles.Should().Have.SameValuesAs(expAdminRev1); + rightsSubject3.Roles.Should().Have.SameValuesAs(expAdminRev2, expDirectorRev3); + lukaszRev3.Roles.Should().Have.SameValuesAs(expAdminRev2, expDirectorRev3); + } + + [Test] + public async Task VerifyHistoryOfAdminAsync() + { + var adminRev1 = await (AuditReader().FindAsync(expAdminRev1.Id, 1)).ConfigureAwait(false); + var adminRev2 = await (AuditReader().FindAsync(expAdminRev1.Id, 2)).ConfigureAwait(false); + var adminRev5 = await (AuditReader().FindAsync(expAdminRev1.Id, 5)).ConfigureAwait(false); + + adminRev1.Should().Be.EqualTo(expAdminRev1); + adminRev2.Should().Be.EqualTo(expAdminRev2); + adminRev1.Members.Should().Have.SameValuesAs(expLukaszRev1); + adminRev5.Members.Should().Have.SameValuesAs(expLukaszRev2, expAdamRev4); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/PolymorphicCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/PolymorphicCollectionTest.cs new file mode 100644 index 00000000..adf0218b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/PolymorphicCollectionTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.Relation +{ + using System.Threading.Tasks; + public partial class PolymorphicCollectionTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToParentEntity), ed_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(ParentIngEntity), p_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 3 }, await (AuditReader().GetRevisionsAsync(typeof(ChildNotIngEntity), c_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollectionAsync() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(ed_id1, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ParentIngEntity { Id = p_id, Data = "x" } }, + (await (AuditReader().FindAsync(ed_id1, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ParentIngEntity { Id = p_id, Data = "x" }, new ChildNotIngEntity{ Id = c_id, Data = "y", Number = 1} }, + (await (AuditReader().FindAsync(ed_id1, 3)).ConfigureAwait(false)).Referencing); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/Unidirectional/UnidirectionalDoubleAbstractTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/Unidirectional/UnidirectionalDoubleAbstractTest.cs new file mode 100644 index 00000000..487b0cc6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Joined/Relation/Unidirectional/UnidirectionalDoubleAbstractTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.Relation.Unidirectional +{ + using System.Threading.Tasks; + public partial class UnidirectionalDoubleAbstractTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(ContainedEntity), cce1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(SetEntity), cse1_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollectionAsync() + { + var cce1 = await (Session.GetAsync(cce1_id)).ConfigureAwait(false); + var entities = (await (AuditReader().FindAsync(cse1_id, 1)).ConfigureAwait(false)).Entities; + Assert.AreEqual(1, entities.Count); + CollectionAssert.Contains(entities, cce1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Mixed/MixedInheritanceStrategiesEntityTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Mixed/MixedInheritanceStrategiesEntityTest.cs new file mode 100644 index 00000000..95802314 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Mixed/MixedInheritanceStrategiesEntityTest.cs @@ -0,0 +1,82 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Mixed +{ + using System.Threading.Tasks; + public partial class MixedInheritanceStrategiesEntityTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (NormalActivity), id1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof(NormalActivity), id3)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(3); + (await (AuditReader().GetRevisionsAsync(typeof(CheckInActivity), id2)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(2, 4); + } + + [Test] + public async Task VerifyCurrentStateOfCheckInActivityAsync() + { + var checkinActivity = await (Session.GetAsync(id2)).ConfigureAwait(false); + var normalActivity = await (Session.GetAsync(id3)).ConfigureAwait(false); + + checkinActivity.Id.Should().Be.EqualTo(id2); + checkinActivity.SequenceNumber.Should().Be.EqualTo(0); + checkinActivity.DurationInMinutes.Should().Be.EqualTo(30); + checkinActivity.RelatedActivity.Id.Should().Be.EqualTo(normalActivity.Id); + checkinActivity.RelatedActivity.SequenceNumber.Should().Be.EqualTo(normalActivity.SequenceNumber); + } + + [Test] + public async Task VerifyCurrentStateOfNormalActivitiesAsync() + { + var normalActivity1 = await (Session.GetAsync(id1)).ConfigureAwait(false); + var normalActivity2 = await (Session.GetAsync(id3)).ConfigureAwait(false); + + normalActivity1.Id.Should().Be.EqualTo(id1); + normalActivity1.SequenceNumber.Should().Be.EqualTo(1); + normalActivity2.Id.Should().Be.EqualTo(id3); + normalActivity2.SequenceNumber.Should().Be.EqualTo(2); + } + + [Test] + public async Task VerifyFirstRevisionOfCheckInActivityAsync() + { + var checkInActivity = await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false); + var normalActivity = await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false); + + checkInActivity.Id.Should().Be.EqualTo(id2); + checkInActivity.SequenceNumber.Should().Be.EqualTo(0); + checkInActivity.DurationInMinutes.Should().Be.EqualTo(30); + checkInActivity.RelatedActivity.Id.Should().Be.EqualTo(normalActivity.Id); + checkInActivity.RelatedActivity.SequenceNumber.Should().Be.EqualTo(normalActivity.SequenceNumber); + } + + [Test] + public async Task VerifySecondRevisionOfCheckInActivityAsync() + { + var checkInActivity = await (AuditReader().FindAsync(id2, 4)).ConfigureAwait(false); + var normalActivity = await (AuditReader().FindAsync(id3, 4)).ConfigureAwait(false); + + checkInActivity.Id.Should().Be.EqualTo(id2); + checkInActivity.SequenceNumber.Should().Be.EqualTo(0); + checkInActivity.DurationInMinutes.Should().Be.EqualTo(30); + checkInActivity.RelatedActivity.Id.Should().Be.EqualTo(normalActivity.Id); + checkInActivity.RelatedActivity.SequenceNumber.Should().Be.EqualTo(normalActivity.SequenceNumber); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ChildAuditingTest.cs new file mode 100644 index 00000000..13a0a780 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ChildAuditingTest.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Single +{ + using System.Threading.Tasks; + public partial class ChildAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ChildEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + var ver1 = new ChildEntity { Id = id1, Data = "x", Number = 1 }; + var ver2 = new ChildEntity { Id = id1, Data = "y", Number = 2 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var childVersion1 = new ChildEntity { Id = id1, Data = "x", Number = 1 }; + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ChildEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ChildRelation/ChildReferencingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ChildRelation/ChildReferencingTest.cs new file mode 100644 index 00000000..e5bf3ed4 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ChildRelation/ChildReferencingTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Single.ChildRelation +{ + using System.Threading.Tasks; + public partial class ChildReferencingTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToChildEntity), re_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToChildEntity), re_id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ChildIngEntity), c_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollection1Async() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id1, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ChildIngEntity { Id = c_id, Data = "y", Number = 1 } }, (await (AuditReader().FindAsync(re_id1, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id1, 3)).ConfigureAwait(false)).Referencing); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollection2Async() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id2, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id2, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ChildIngEntity { Id = c_id, Data = "y", Number = 1 } }, (await (AuditReader().FindAsync(re_id2, 3)).ConfigureAwait(false)).Referencing); + } + + [Test] + public async Task VerifyChildHistoryAsync() + { + Assert.IsNull(await (AuditReader().FindAsync(c_id, 1)).ConfigureAwait(false)); + Assert.AreEqual(new ReferencedToChildEntity { Id = re_id1 }, (await (AuditReader().FindAsync(c_id, 2)).ConfigureAwait(false)).Referenced); + Assert.AreEqual(new ReferencedToChildEntity { Id = re_id2 }, (await (AuditReader().FindAsync(c_id, 3)).ConfigureAwait(false)).Referenced); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/DiscriminatorFormula/DiscriminatorFormulaTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/DiscriminatorFormula/DiscriminatorFormulaTest.cs new file mode 100644 index 00000000..546b1d5f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/DiscriminatorFormula/DiscriminatorFormulaTest.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Single.DiscriminatorFormula +{ + using System.Threading.Tasks; + public partial class DiscriminatorFormulaTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ChildEntity),childVer1.Id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity),parentVer1.Id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + (await (AuditReader().FindAsync(parentVer1.Id, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(parentVer1); + (await (AuditReader().FindAsync(parentVer2.Id, 4)).ConfigureAwait(false)) + .Should().Be.EqualTo(parentVer2); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + (await (AuditReader().FindAsync(childVer1.Id, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(childVer1); + (await (AuditReader().FindAsync(childVer2.Id, 3)).ConfigureAwait(false)) + .Should().Be.EqualTo(childVer2); + } + + [Test] + public async Task PolymorphicQueryAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1).ResultsAsync()).ConfigureAwait(false)).First() + .Should().Be.EqualTo(childVer1); + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1).ResultsAsync()).ConfigureAwait(false)).First() + .Should().Be.EqualTo(childVer1); + + (await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (ChildEntity), true, false).GetResultListAsync()).ConfigureAwait(false)) + .Should().Have.SameValuesAs(childVer1, childVer2); + (await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof(ParentEntity), true, false).GetResultListAsync()).ConfigureAwait(false)) + .Should().Have.SameValuesAs(childVer1, childVer2, parentVer1, parentVer2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/NotOwnedRelation/NotOwnBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/NotOwnedRelation/NotOwnBidirectionalTest.cs new file mode 100644 index 00000000..12ca80b8 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/NotOwnedRelation/NotOwnBidirectionalTest.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Single.NotOwnedRelation +{ + using System.Threading.Tasks; + public partial class NotOwnBidirectionalTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(Contact), pc_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(PersonalContact), pc_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Address), a1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(Address), a2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfContactAsync() + { + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" } }, + (await (AuditReader().FindAsync(pc_id, 1)).ConfigureAwait(false)).Addresses); + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" }, new Address { Id = a2_id, Address1 = "a2" } }, + (await (AuditReader().FindAsync(pc_id, 2)).ConfigureAwait(false)).Addresses); + } + + [Test] + public async Task VerifyHistoryOfPersonalContactAsync() + { + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" } }, + (await (AuditReader().FindAsync(pc_id, 1)).ConfigureAwait(false)).Addresses); + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" }, new Address { Id = a2_id, Address1 = "a2" } }, + (await (AuditReader().FindAsync(pc_id, 2)).ConfigureAwait(false)).Addresses); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ParentAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ParentAuditingTest.cs new file mode 100644 index 00000000..de7e2e41 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/ParentAuditingTest.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Single +{ + using System.Threading.Tasks; + public partial class ParentAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + Assert.IsNull(await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + var ver1 = new ParentEntity { Id = id1, Data = "x" }; + var ver2 = new ParentEntity { Id = id1, Data = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var childVersion1 = new ParentEntity { Id = id1, Data = "x" }; + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + CollectionAssert.IsEmpty(await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ChildEntity), 1).GetResultListAsync()).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/Relation/PolymorphicCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/Relation/PolymorphicCollectionTest.cs new file mode 100644 index 00000000..382afcb5 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/Single/Relation/PolymorphicCollectionTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.Single.Relation +{ + using System.Threading.Tasks; + public partial class PolymorphicCollectionTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToParentEntity), ed_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(ParentIngEntity), p_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 3 }, await (AuditReader().GetRevisionsAsync(typeof(ChildNotIngEntity), c_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollectionAsync() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(ed_id1, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ParentIngEntity { Id = p_id, Data = "x" } }, + (await (AuditReader().FindAsync(ed_id1, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ParentIngEntity { Id = p_id, Data = "x" }, new ChildNotIngEntity{ Id = c_id, Data = "y", Number = 1} }, + (await (AuditReader().FindAsync(ed_id1, 3)).ConfigureAwait(false)).Referencing); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ChildAuditingTest.cs new file mode 100644 index 00000000..6d50acdd --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ChildAuditingTest.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass +{ + using System.Threading.Tasks; + public partial class ChildAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ChildEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + var ver1 = new ChildEntity { Id = id1, Data = "x", Number = 1 }; + var ver2 = new ChildEntity { Id = id1, Data = "y", Number = 2 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var childVersion1 = new ChildEntity { Id = id1, Data = "x", Number = 1 }; + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ChildEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ChildRelation/ChildReferencingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ChildRelation/ChildReferencingTest.cs new file mode 100644 index 00000000..b214b73f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ChildRelation/ChildReferencingTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass.ChildRelation +{ + using System.Threading.Tasks; + public partial class ChildReferencingTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToChildEntity), re_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToChildEntity), re_id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ChildIngEntity), c_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollection1Async() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id1, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ChildIngEntity { Id = c_id, Data = "y", Number = 1 } }, (await (AuditReader().FindAsync(re_id1, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id1, 3)).ConfigureAwait(false)).Referencing); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollection2Async() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id2, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(re_id2, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ChildIngEntity { Id = c_id, Data = "y", Number = 1 } }, (await (AuditReader().FindAsync(re_id2, 3)).ConfigureAwait(false)).Referencing); + } + + [Test] + public async Task VerifyChildHistoryAsync() + { + Assert.IsNull(await (AuditReader().FindAsync(c_id, 1)).ConfigureAwait(false)); + Assert.AreEqual(new ReferencedToChildEntity { Id = re_id1 }, (await (AuditReader().FindAsync(c_id, 2)).ConfigureAwait(false)).Referenced); + Assert.AreEqual(new ReferencedToChildEntity { Id = re_id2 }, (await (AuditReader().FindAsync(c_id, 3)).ConfigureAwait(false)).Referenced); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/NotOwnedRelation/NotOwnBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/NotOwnedRelation/NotOwnBidirectionalTest.cs new file mode 100644 index 00000000..e791d009 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/NotOwnedRelation/NotOwnBidirectionalTest.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass.NotOwnedRelation +{ + using System.Threading.Tasks; + public partial class NotOwnBidirectionalTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(Contact), pc_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(PersonalContact), pc_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Address), a1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(Address), a2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfContactAsync() + { + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" } }, + (await (AuditReader().FindAsync(pc_id, 1)).ConfigureAwait(false)).Addresses); + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" }, new Address { Id = a2_id, Address1 = "a2" } }, + (await (AuditReader().FindAsync(pc_id, 2)).ConfigureAwait(false)).Addresses); + } + + [Test] + public async Task VerifyHistoryOfPersonalContactAsync() + { + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" } }, + (await (AuditReader().FindAsync(pc_id, 1)).ConfigureAwait(false)).Addresses); + CollectionAssert.AreEquivalent(new[] { new Address { Id = a1_id, Address1 = "a1" }, new Address { Id = a2_id, Address1 = "a2" } }, + (await (AuditReader().FindAsync(pc_id, 2)).ConfigureAwait(false)).Addresses); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ParentAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ParentAuditingTest.cs new file mode 100644 index 00000000..8c233b53 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/ParentAuditingTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Dialect; +using NHibernate.Envers.Strategy; +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass +{ + using System.Threading.Tasks; + public partial class ParentAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + Assert.IsNull(await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + var ver1 = new ParentEntity { Id = id1, Data = "x" }; + var ver2 = new ParentEntity { Id = id1, Data = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyPolymorphicQueryAsync() + { + var childVersion1 = new ParentEntity { Id = id1, Data = "x" }; + Assert.AreEqual(childVersion1, await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ParentEntity), 1).GetSingleResultAsync()).ConfigureAwait(false)); + CollectionAssert.IsEmpty(await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(ChildEntity), 1).GetResultListAsync()).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/Relation/PolymorphicCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/Relation/PolymorphicCollectionTest.cs new file mode 100644 index 00000000..11dc6994 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Inheritance/TablePerClass/Relation/PolymorphicCollectionTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass.Relation +{ + using System.Threading.Tasks; + public partial class PolymorphicCollectionTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ReferencedToParentEntity), ed_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(ParentIngEntity), p_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 3 }, await (AuditReader().GetRevisionsAsync(typeof(ChildNotIngEntity), c_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfReferencedCollectionAsync() + { + CollectionAssert.IsEmpty((await (AuditReader().FindAsync(ed_id1, 1)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ParentIngEntity { Id = p_id, Data = "x" } }, + (await (AuditReader().FindAsync(ed_id1, 2)).ConfigureAwait(false)).Referencing); + CollectionAssert.AreEquivalent(new[] { new ParentIngEntity { Id = p_id, Data = "x" }, new ChildNotIngEntity { Id = c_id, Data = "y", Number = 1 } }, + (await (AuditReader().FindAsync(ed_id1, 3)).ConfigureAwait(false)).Referencing); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Components/InterfacesComponentsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Components/InterfacesComponentsTest.cs new file mode 100644 index 00000000..c77106d1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Components/InterfacesComponentsTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Interfaces.Components +{ + using System.Threading.Tasks; + public partial class InterfacesComponentsTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ComponentTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new ComponentTestEntity { Id = id1, Comp1 = new Component1 { Data = "a" } }; + var ver2 = new ComponentTestEntity { Id = id1, Comp1 = new Component1 { Data = "b" } }; + var ver3 = new ComponentTestEntity { Id = id1, Comp1 = new Component1 { Data = "c" } }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/AllAudited/AbstractAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/AllAudited/AbstractAllAuditedTest.cs new file mode 100644 index 00000000..33114369 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/AllAudited/AbstractAllAuditedTest.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Interfaces.Inheritance.AllAudited +{ + using System.Threading.Tasks; + public abstract partial class AbstractAllAuditedTest : TestBase + { + + [Test] + public async Task VerifyRevisionsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (AuditedImplementor), aiId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyRetrieveAuditedAsync() + { + var ai = await (Session.GetAsync(aiId)).ConfigureAwait(false); + var si = await (Session.GetAsync(aiId)).ConfigureAwait(false); + var aiRev1 = await (AuditReader().FindAsync(aiId, 1)).ConfigureAwait(false); + var siRev1 = await (AuditReader().FindAsync(aiId, 1)).ConfigureAwait(false); + var aiRev2 = await (AuditReader().FindAsync(aiId, 2)).ConfigureAwait(false); + var siRev2 = await (AuditReader().FindAsync(aiId, 2)).ConfigureAwait(false); + + ai.Data.Should().Be.EqualTo("La data 2"); + si.Data.Should().Be.EqualTo("La data 2"); + aiRev1.Data.Should().Be.EqualTo("La data"); + siRev1.Data.Should().Be.EqualTo("La data"); + aiRev2.Data.Should().Be.EqualTo("La data 2"); + siRev2.Data.Should().Be.EqualTo("La data 2"); + } + + [Test] + public async Task VerifyRetrieveNonAuditedAsync() + { + var nai = await (Session.GetAsync(naiId)).ConfigureAwait(false); + var si = await (Session.GetAsync(naiId)).ConfigureAwait(false); + + si.Data.Should().Be.EqualTo(nai.Data); + + Assert.Throws(() => + AuditReader().Find(naiId, 1)); + + (await (AuditReader().FindAsync(naiId, 1)).ConfigureAwait(false)) + .Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/PropertiesAudited/AbstractAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/PropertiesAudited/AbstractAllAuditedTest.cs new file mode 100644 index 00000000..b629a271 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/PropertiesAudited/AbstractAllAuditedTest.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Interfaces.Inheritance.PropertiesAudited +{ + using System.Threading.Tasks; + public abstract partial class AbstractAllAuditedTest : TestBase + { + + [Test] + public async Task VerifyRetrieveAuditedAsync() + { + var ai = await (Session.GetAsync(aiId)).ConfigureAwait(false); + var si = await (Session.GetAsync(aiId)).ConfigureAwait(false); + var aiRev1 = await (AuditReader().FindAsync(aiId, 1)).ConfigureAwait(false); + var siRev1 = await (AuditReader().FindAsync(aiId, 1)).ConfigureAwait(false); + + ai.Data.Should().Be.EqualTo("La data"); + si.Data.Should().Be.EqualTo("La data"); + aiRev1.Data.Should().Be.Null(); + siRev1.Data.Should().Be.Null(); + siRev1.Number.Should().Be.EqualTo(NUMBER); + siRev1.Number.Should().Be.EqualTo(NUMBER); + } + + [Test] + public async Task VerifyRetrieveNonAuditedAsync() + { + var nai = await (Session.GetAsync(naiId)).ConfigureAwait(false); + var si = await (Session.GetAsync(naiId)).ConfigureAwait(false); + + si.Data.Should().Be.EqualTo(nai.Data); + + Assert.Throws(() => + AuditReader().Find(naiId, 1)); + + (await (AuditReader().FindAsync(naiId, 1)).ConfigureAwait(false)) + .Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/PropertiesAudited2/AbstractAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/PropertiesAudited2/AbstractAllAuditedTest.cs new file mode 100644 index 00000000..dc35d499 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Inheritance/PropertiesAudited2/AbstractAllAuditedTest.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Interfaces.Inheritance.PropertiesAudited2 +{ + using System.Threading.Tasks; + public abstract partial class AbstractAllAuditedTest : TestBase + { + + [Test] + public async Task VerifyRetrieveAuditedAsync() + { + var ai = await (Session.GetAsync(aiId)).ConfigureAwait(false); + var si = await (Session.GetAsync(aiId)).ConfigureAwait(false); + var aiRev1 = await (AuditReader().FindAsync(aiId, 1)).ConfigureAwait(false); + var siRev1 = await (AuditReader().FindAsync(aiId, 1)).ConfigureAwait(false); + + ai.Data.Should().Be.EqualTo("La data"); + si.Data.Should().Be.EqualTo("La data"); + aiRev1.Data.Should().Be.EqualTo("La data"); + siRev1.Data.Should().Be.EqualTo("La data"); + siRev1.Number.Should().Be.EqualTo(NUMBER); + siRev1.Number.Should().Be.EqualTo(NUMBER); + } + + [Test] + public async Task VerifyRetrieveNonAuditedAsync() + { + var nai = await (Session.GetAsync(naiId)).ConfigureAwait(false); + var si = await (Session.GetAsync(naiId)).ConfigureAwait(false); + + si.Data.Should().Be.EqualTo(nai.Data); + + Assert.Throws(() => + AuditReader().Find(naiId, 1)); + + (await (AuditReader().FindAsync(naiId, 1)).ConfigureAwait(false)) + .Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Relation/InterfacesRelationTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Relation/InterfacesRelationTest.cs new file mode 100644 index 00000000..ec639cc0 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Interfaces/Relation/InterfacesRelationTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Interfaces.Relation +{ + using System.Threading.Tasks; + public partial class InterfacesRelationTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), ing1_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEdIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + + Assert.IsNull(rev1); + Assert.AreEqual(ed1, rev2.Reference); + Assert.AreEqual(ed2, rev3.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Join/BasicJoinTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Join/BasicJoinTest.cs new file mode 100644 index 00000000..65e96db9 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Join/BasicJoinTest.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Join +{ + using System.Threading.Tasks; + public partial class BasicJoinTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + CollectionAssert.AreEquivalent(new[]{1, 2}, await (AuditReader().GetRevisionsAsync(typeof(JoinTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new JoinTestEntity { Id = id, S1 = "a", S2 = "1" }; + var ver2 = new JoinTestEntity { Id = id, S1 = "b", S2 = "2" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Join/NamingJoinTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Join/NamingJoinTest.cs new file mode 100644 index 00000000..7bfb481f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Join/NamingJoinTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Join +{ + using System.Threading.Tasks; + public partial class NamingJoinTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(JoinWithAuditNameEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new JoinWithAuditNameEntity { Id = id, S1 = "a", S2 = "1" }; + var ver2 = new JoinWithAuditNameEntity { Id = id, S1 = "b", S2 = "2" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicListTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicListTest.cs new file mode 100644 index 00000000..96b29183 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicListTest.cs @@ -0,0 +1,106 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.ManyToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany +{ + using System.Threading.Tasks; + public partial class BasicListTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ListOwnedEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 5 }, await (AuditReader().GetRevisionsAsync(typeof(ListOwnedEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4, 5 }, await (AuditReader().GetRevisionsAsync(typeof(ListOwningEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ListOwningEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ed1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[]{ing1, ing2}, rev2.Referencing); + CollectionAssert.AreEquivalent(new[]{ing1, ing2}, rev3.Referencing); + CollectionAssert.AreEquivalent(new[]{ing2}, rev4.Referencing); + CollectionAssert.AreEquivalent(new[]{ing2}, rev5.Referencing); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ed2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev3.Referencing); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev4.Referencing); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev5.Referencing); + } + + [Test] + public async Task VerifyHistoryIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { ed1 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { ed2 }, rev4.References); + CollectionAssert.IsEmpty(rev5.References); + } + + [Test] + public async Task VerifyHistoryIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev4.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev5.References); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicMapTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicMapTest.cs new file mode 100644 index 00000000..b855181b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicMapTest.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Tests.Entities.ManyToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany +{ + using System.Threading.Tasks; + public partial class BasicMapTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(MapOwnedEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(MapOwnedEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(MapOwningEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(MapOwningEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev3.Referencing); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { ing2 }, rev1.Referencing); + CollectionAssert.IsEmpty(rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev3.Referencing); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + + Assert.AreEqual(1, rev2.References.Count); + Assert.AreEqual(new KeyValuePair("1", ed1), rev2.References.First()); + + CollectionAssert.IsEmpty(rev3.References); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(1, rev1.References.Count); + Assert.AreEqual(new KeyValuePair("2", ed2), rev1.References.First()); + + Assert.AreEqual(1, rev1.References.Count); + Assert.AreEqual(new KeyValuePair("2", ed1), rev2.References.First()); + + Assert.AreEqual(2, rev3.References.Count); + CollectionAssert.Contains(rev3.References, new KeyValuePair("1", ed1)); + CollectionAssert.Contains(rev3.References, new KeyValuePair("2", ed2)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicSetTest.cs new file mode 100644 index 00000000..977056b6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicSetTest.cs @@ -0,0 +1,106 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.ManyToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany +{ + using System.Threading.Tasks; + public partial class BasicSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(SetOwnedEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 5 }, await (AuditReader().GetRevisionsAsync(typeof(SetOwnedEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4, 5 }, await (AuditReader().GetRevisionsAsync(typeof(SetOwningEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(SetOwningEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ed1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev3.Referencing); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev4.Referencing); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev5.Referencing); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ed2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev3.Referencing); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev4.Referencing); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev5.Referencing); + } + + [Test] + public async Task VerifyHistoryIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { ed1 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { ed2 }, rev4.References); + CollectionAssert.IsEmpty(rev5.References); + } + + [Test] + public async Task VerifyHistoryIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev4.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev5.References); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicWhereJoinTableTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicWhereJoinTableTest.cs new file mode 100644 index 00000000..e27407b0 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BasicWhereJoinTableTest.cs @@ -0,0 +1,82 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.ManyToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany +{ + using System.Threading.Tasks; + public partial class BasicWhereJoinTableTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(WhereJoinTableEntity), wjte1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(WhereJoinTableEntity), wjte2_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(IntNoAutoIdTestEntity), ite1_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(IntNoAutoIdTestEntity), ite1_2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(IntNoAutoIdTestEntity), ite2_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(IntNoAutoIdTestEntity), ite2_2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfWjte1Async() + { + var ite1_1 = await (Session.GetAsync(ite1_1_id)).ConfigureAwait(false); + var ite2_1 = await (Session.GetAsync(ite2_1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(wjte1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(wjte1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(wjte1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(wjte1_id, 4)).ConfigureAwait(false); + + // Checking 1st list + CollectionAssert.IsEmpty(rev1.References1); + CollectionAssert.AreEquivalent(new[] { ite1_1 }, rev2.References1); + CollectionAssert.AreEquivalent(new[] { ite1_1 }, rev3.References1); + CollectionAssert.IsEmpty(rev4.References1); + + // Checking 2nd list + CollectionAssert.IsEmpty(rev1.References2); + CollectionAssert.AreEquivalent(new[] { ite2_1 }, rev2.References2); + CollectionAssert.AreEquivalent(new[] { ite2_1 }, rev3.References2); + CollectionAssert.AreEquivalent(new[] { ite2_1 }, rev4.References2); + } + + [Test] + public async Task VerifyHistoryOfWjte2Async() + { + var ite1_1 = await (Session.GetAsync(ite1_1_id)).ConfigureAwait(false); + var ite1_2 = await (Session.GetAsync(ite1_2_id)).ConfigureAwait(false); + var ite2_2 = await (Session.GetAsync(ite2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(wjte2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(wjte2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(wjte2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(wjte2_id, 4)).ConfigureAwait(false); + + // Checking 1st list + CollectionAssert.IsEmpty(rev1.References1); + CollectionAssert.IsEmpty(rev2.References1); + CollectionAssert.AreEquivalent(new[] { ite1_1, ite1_2 }, rev3.References1); + CollectionAssert.AreEquivalent(new[] { ite1_1, ite1_2 }, rev4.References1); + + // Checking 2nd list + CollectionAssert.IsEmpty(rev1.References2); + CollectionAssert.IsEmpty(rev2.References2); + CollectionAssert.IsEmpty(rev3.References2); + CollectionAssert.AreEquivalent(new[] { ite2_2 }, rev4.References2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BiOwned/BasicBiOwnedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BiOwned/BasicBiOwnedTest.cs new file mode 100644 index 00000000..476f1070 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/BiOwned/BasicBiOwnedTest.cs @@ -0,0 +1,109 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.ManyToMany.BiOwned; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.BiOwned +{ + using System.Threading.Tasks; + public partial class BasicBiOwnedTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + // Although it would seem that when modifying references both entities should be marked as modified, because + // ownly the owning side is notified (because of the bi-owning mapping), a revision is created only for + // the entity where the collection was directly modified. + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 5 }, await (AuditReader().GetRevisionsAsync(typeof(ListBiOwning1Entity), o1_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 5 }, await (AuditReader().GetRevisionsAsync(typeof(ListBiOwning1Entity), o1_2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ListBiOwning2Entity), o2_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ListBiOwning2Entity), o2_2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfO1_1Async() + { + var o2_1 = await (Session.GetAsync(o2_1_id)).ConfigureAwait(false); + var o2_2 = await (Session.GetAsync(o2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(o1_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(o1_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(o1_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(o1_1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(o1_1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[] { o2_1 }, rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { o2_1, o2_2 }, rev3.Referencing); + CollectionAssert.IsEmpty(rev4.Referencing); + CollectionAssert.AreEquivalent(new[] { o2_2 }, rev5.Referencing); + } + + [Test] + public async Task VerifyHistoryOfO1_2Async() + { + var o2_1 = await (Session.GetAsync(o2_1_id)).ConfigureAwait(false); + var o2_2 = await (Session.GetAsync(o2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(o1_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(o1_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(o1_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(o1_2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(o1_2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[] { o2_2 }, rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { o2_2 }, rev3.Referencing); + CollectionAssert.AreEquivalent(new[] { o2_1, o2_2 }, rev4.Referencing); + CollectionAssert.AreEquivalent(new[] { o2_2 }, rev5.Referencing); + } + + [Test] + public async Task VerifyHistoryOfO2_1Async() + { + var o1_1 = await (Session.GetAsync(o1_1_id)).ConfigureAwait(false); + var o1_2 = await (Session.GetAsync(o1_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(o2_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(o2_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(o2_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(o2_1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(o2_1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[] { o1_1 }, rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { o1_1 }, rev3.Referencing); + CollectionAssert.AreEquivalent(new[] { o1_2 }, rev4.Referencing); + CollectionAssert.IsEmpty(rev5.Referencing); + } + + [Test] + public async Task VerifyHistoryOfO2_2Async() + { + var o1_1 = await (Session.GetAsync(o1_1_id)).ConfigureAwait(false); + var o1_2 = await (Session.GetAsync(o1_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(o2_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(o2_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(o2_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(o2_2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(o2_2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Referencing); + CollectionAssert.AreEquivalent(new[] { o1_2 }, rev2.Referencing); + CollectionAssert.AreEquivalent(new[] { o1_1, o1_2 }, rev3.Referencing); + CollectionAssert.AreEquivalent(new[] { o1_2 }, rev4.Referencing); + CollectionAssert.AreEquivalent(new[] { o1_1, o1_2 }, rev5.Referencing); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/InverseToSuperclass/ManyToManyInverseToSuperclassTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/InverseToSuperclass/ManyToManyInverseToSuperclassTest.cs new file mode 100644 index 00000000..dc7d2292 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/InverseToSuperclass/ManyToManyInverseToSuperclassTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.InverseToSuperclass +{ + using System.Threading.Tasks; + public partial class ManyToManyInverseToSuperclassTest : TestBase + { + + [Test] + public async Task HistoryShouldExistAsync() + { + var rev1 = await (AuditReader().FindAsync(masterId, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(masterId, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(masterId, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(masterId, 4)).ConfigureAwait(false); + + rev1.Should().Not.Be.Null(); + rev2.Should().Not.Be.Null(); + rev3.Should().Not.Be.Null(); + rev4.Should().Not.Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/SameTable/BasicSameTableTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/SameTable/BasicSameTableTest.cs new file mode 100644 index 00000000..7bab8b3f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/SameTable/BasicSameTableTest.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.ManyToMany.SameTable; +using NHibernate.SqlTypes; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.SameTable +{ + using System.Threading.Tasks; + public partial class BasicSameTableTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity), p1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity), p2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Child1Entity), c1_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 5 }, await (AuditReader().GetRevisionsAsync(typeof(Child1Entity), c1_2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Child2Entity), c2_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 5 }, await (AuditReader().GetRevisionsAsync(typeof(Child2Entity), c2_2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfParent1Async() + { + var c1_1 = await (Session.GetAsync(c1_1_id)).ConfigureAwait(false); + var c1_2 = await (Session.GetAsync(c1_2_id)).ConfigureAwait(false); + var c2_2 = await (Session.GetAsync(c2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(p1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(p1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(p1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(p1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(p1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1 }, rev2.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1, c1_2 }, rev3.Children1); + CollectionAssert.AreEquivalent(new[] { c1_2 }, rev4.Children1); + CollectionAssert.IsEmpty(rev5.Children1); + + CollectionAssert.IsEmpty(rev1.Children2); + CollectionAssert.IsEmpty(rev2.Children2); + CollectionAssert.AreEquivalent(new[] { c2_2 }, rev3.Children2); + CollectionAssert.AreEquivalent(new[] { c2_2 }, rev4.Children2); + CollectionAssert.AreEquivalent(new[] { c2_2 }, rev5.Children2); + } + + [Test] + public async Task VerifyHistoryOfParent2Async() + { + var c1_1 = await (Session.GetAsync(c1_1_id)).ConfigureAwait(false); + var c2_1 = await (Session.GetAsync(c2_1_id)).ConfigureAwait(false); + var c2_2 = await (Session.GetAsync(c2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(p2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(p2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(p2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(p2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(p2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Children1); + CollectionAssert.IsEmpty(rev2.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1 }, rev3.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1 }, rev4.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1 }, rev5.Children1); + + CollectionAssert.IsEmpty(rev1.Children2); + CollectionAssert.AreEquivalent(new[] { c2_1 }, rev2.Children2); + CollectionAssert.AreEquivalent(new[] { c2_1 }, rev3.Children2); + CollectionAssert.AreEquivalent(new[] { c2_1, c2_2 }, rev4.Children2); + CollectionAssert.AreEquivalent(new[] { c2_1 }, rev5.Children2); + } + + [Test] + public async Task VerifyHistoryOfChild1_1Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c1_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c1_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c1_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c1_1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c1_1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev2.Parents); + CollectionAssert.AreEquivalent(new[] { p1, p2 }, rev3.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev4.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev5.Parents); + } + + [Test] + public async Task VerifyHistoryOfChild1_2Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c1_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c1_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c1_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c1_2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c1_2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Parents); + CollectionAssert.IsEmpty(rev2.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev3.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev4.Parents); + CollectionAssert.IsEmpty(rev5.Parents); + } + + [Test] + public async Task VerifyHistoryOfChild2_1Async() + { + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c2_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c2_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c2_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c2_1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c2_1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev2.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev3.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev4.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev5.Parents); + } + + [Test] + public async Task VerifyHistoryOfChild2_2Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c2_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c2_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c2_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c2_2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c2_2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Parents); + CollectionAssert.IsEmpty(rev2.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev3.Parents); + CollectionAssert.AreEquivalent(new[] { p1, p2 }, rev4.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev5.Parents); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/Ternary/TernaryMapFlushTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/Ternary/TernaryMapFlushTest.cs new file mode 100644 index 00000000..bcc8b6fb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/Ternary/TernaryMapFlushTest.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.Ternary +{ + using System.Threading.Tasks; + public partial class TernaryMapFlushTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(TernaryMapEntity), map1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestPrivSeqEntity), str1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestPrivSeqEntity), str2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(IntTestPrivSeqEntity), int1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(IntTestPrivSeqEntity), int2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfMap1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + var str2 = await (Session.GetAsync(str2_id)).ConfigureAwait(false); + var int1 = await (Session.GetAsync(int1_id)).ConfigureAwait(false); + var int2 = await (Session.GetAsync(int2_id)).ConfigureAwait(false); + + + var rev1 = await (AuditReader().FindAsync(map1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(map1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(map1_id, 3)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new Dictionary { { int1, str1 } }, rev1.Map); + CollectionAssert.AreEquivalent(new Dictionary { { int1, str1 }, { int2, str2 } }, rev2.Map); + CollectionAssert.AreEquivalent(new Dictionary { { int2, str1 } }, rev3.Map); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/Ternary/TernaryMapTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/Ternary/TernaryMapTest.cs new file mode 100644 index 00000000..df1e4a11 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/Ternary/TernaryMapTest.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.Ternary +{ + using System.Threading.Tasks; + public partial class TernaryMapTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(TernaryMapEntity), map1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(TernaryMapEntity), map2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestPrivSeqEntity), str1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestPrivSeqEntity), str2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(IntTestPrivSeqEntity), int1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(IntTestPrivSeqEntity), int2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfMap1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + var str2 = await (Session.GetAsync(str2_id)).ConfigureAwait(false); + var int1 = await (Session.GetAsync(int1_id)).ConfigureAwait(false); + var int2 = await (Session.GetAsync(int2_id)).ConfigureAwait(false); + + + var rev1 = await (AuditReader().FindAsync(map1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(map1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(map1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(map1_id, 4)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new Dictionary { { int1, str1 } }, rev1.Map); + CollectionAssert.AreEquivalent(new Dictionary { { int1, str2 } }, rev2.Map); + CollectionAssert.AreEquivalent(new Dictionary { { int1, str2 } }, rev3.Map); + CollectionAssert.AreEquivalent(new Dictionary { { int1, str2 }, { int2, str2 } }, rev4.Map); + } + + [Test] + public async Task VerifyHistoryOfMap2Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + var str2 = await (Session.GetAsync(str2_id)).ConfigureAwait(false); + var int1 = await (Session.GetAsync(int1_id)).ConfigureAwait(false); + var int2 = await (Session.GetAsync(int2_id)).ConfigureAwait(false); + + + var rev1 = await (AuditReader().FindAsync(map2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(map2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(map2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(map2_id, 4)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Map); + CollectionAssert.AreEquivalent(new Dictionary { { int1, str1 }, { int2, str1 } }, rev2.Map); + CollectionAssert.AreEquivalent(new Dictionary { { int2, str1 } }, rev3.Map); + CollectionAssert.AreEquivalent(new Dictionary { { int1, str2 }, { int2, str1 } }, rev4.Map); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniListTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniListTest.cs new file mode 100644 index 00000000..3194266f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniListTest.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.ManyToMany.UniDirectional; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional +{ + using System.Threading.Tasks; + public partial class BasicUniListTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4, 5 }, await (AuditReader().GetRevisionsAsync(typeof(ListUniEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ListUniEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { ed1 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { ed2 }, rev4.References); + CollectionAssert.IsEmpty(rev5.References); + } + + [Test] + public async Task VerifyHistoryIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev4.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev5.References); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniMapTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniMapTest.cs new file mode 100644 index 00000000..15856e88 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniMapTest.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.ManyToMany.UniDirectional; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional +{ + using System.Threading.Tasks; + public partial class BasicUniMapTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(MapUniEntity), coll1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryColl1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + var str2 = await (Session.GetAsync(str2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(coll1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(coll1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(coll1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(coll1_id, 4)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new Dictionary {{"1", str1}}, rev1.References); + CollectionAssert.AreEquivalent(new Dictionary {{"1", str1}, {"2", str2}}, rev2.References); + CollectionAssert.AreEquivalent(new Dictionary {{"1", str1}, {"2", str1}}, rev3.References); + CollectionAssert.AreEquivalent(new Dictionary {{"2", str1}}, rev4.References); + + Assert.AreEqual("coll1", rev1.Data); + Assert.AreEqual("coll1", rev2.Data); + Assert.AreEqual("coll1", rev3.Data); + Assert.AreEqual("coll1", rev4.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniSetTest.cs new file mode 100644 index 00000000..4cc7af8a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/BasicUniSetTest.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.ManyToMany.UniDirectional; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional +{ + using System.Threading.Tasks; + public partial class BasicUniSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4, 5 }, await (AuditReader().GetRevisionsAsync(typeof(SetUniEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(SetUniEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { ed1 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { ed2 }, rev4.References); + CollectionAssert.IsEmpty(rev5.References); + } + + [Test] + public async Task VerifyHistoryIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev4.References); + CollectionAssert.AreEquivalent(new[] { ed1, ed2 }, rev5.References); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/M2MIndexedListNotAuditedTargetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/M2MIndexedListNotAuditedTargetTest.cs new file mode 100644 index 00000000..76d02bc0 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/M2MIndexedListNotAuditedTargetTest.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.ManyToMany.UniDirectional; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional +{ + using System.Threading.Tasks; + public partial class M2MIndexedListNotAuditedTargetTest :TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (M2MIndexedListTargetNotAuditedEntity), itnae1_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 3); + (await (AuditReader().GetRevisionsAsync(typeof (M2MIndexedListTargetNotAuditedEntity), itnae2_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(2); + } + + [Test] + public async Task VerifyHistory1Async() + { + (await (AuditReader().FindAsync(itnae1_id, 1)).ConfigureAwait(false)).References + .Should().Have.SameSequenceAs(uste1, uste2); + (await (AuditReader().FindAsync(itnae1_id, 2)).ConfigureAwait(false)).References + .Should().Have.SameSequenceAs(uste1, uste2); + (await (AuditReader().FindAsync(itnae1_id, 3)).ConfigureAwait(false)).References + .Should().Have.SameSequenceAs(uste2, uste1); + } + + + [Test] + public async Task VerifyHistory2Async() + { + (await (AuditReader().FindAsync(itnae2_id, 1)).ConfigureAwait(false)).Should().Be.Null(); + (await (AuditReader().FindAsync(itnae2_id, 2)).ConfigureAwait(false)).References + .Should().Have.SameSequenceAs(uste2); + (await (AuditReader().FindAsync(itnae2_id, 3)).ConfigureAwait(false)).References + .Should().Have.SameSequenceAs(uste2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/M2MRelationNotAuditedTargetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/M2MRelationNotAuditedTargetTest.cs new file mode 100644 index 00000000..76d9b261 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToMany/UniDirectional/M2MRelationNotAuditedTargetTest.cs @@ -0,0 +1,65 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.ManyToMany.UniDirectional; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional +{ + using System.Threading.Tasks; + public partial class M2MRelationNotAuditedTargetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(M2MTargetNotAuditedEntity), tnae1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(M2MTargetNotAuditedEntity), tnae2_id)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryNae1Async() + { + var uste1 = await (Session.GetAsync(uste1_id)).ConfigureAwait(false); + var uste2 = await (Session.GetAsync(uste2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(tnae1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(tnae1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(tnae1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(tnae1_id, 4)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEquivalent(new[] { uste1 }, rev2.References); + CollectionAssert.AreEquivalent(new[] { uste1 }, rev3.References); + CollectionAssert.AreEquivalent(new[] { uste1, uste2 }, rev4.References); + } + + [Test] + public async Task VerifyHistoryNae2Async() + { + var uste1 = await (Session.GetAsync(uste1_id)).ConfigureAwait(false); + var uste2 = await (Session.GetAsync(uste2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(tnae2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(tnae2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(tnae2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(tnae2_id, 4)).ConfigureAwait(false); + + + CollectionAssert.AreEquivalent(new[] { uste1, uste2 }, rev1.References); + CollectionAssert.AreEquivalent(new[] { uste2 }, rev2.References); + CollectionAssert.IsEmpty(rev3.References); + CollectionAssert.AreEquivalent(new[] { uste1 }, rev4.References); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToOne/BiDirectional/ImplicitMappedByTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToOne/BiDirectional/ImplicitMappedByTest.cs new file mode 100644 index 00000000..86d3ae5b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToOne/BiDirectional/ImplicitMappedByTest.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ManyToOne.BiDirectional +{ + using System.Threading.Tasks; + public partial class ImplicitMappedByTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (OneToManyOwned), ownedId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof(ManyToOneOwning), owning1Id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof(ManyToOneOwning), owning2Id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 3); + } + + [Test] + public async Task VerifyHistoryOfOwnedAsync() + { + var owned = new OneToManyOwned {Data = "data", Id = ownedId}; + var owning1 = new ManyToOneOwning {Data = "data1", References = owned, Id = owning1Id}; + var owning2 = new ManyToOneOwning {Data = "data2", References = owned, Id = owning2Id}; + + var ver1 = await (AuditReader().FindAsync(ownedId, 1)).ConfigureAwait(false); + ver1.Should().Be.EqualTo(owned); + ver1.Referencing.Should().Have.SameValuesAs(owning1, owning2); + + var ver2 = await (AuditReader().FindAsync(ownedId, 2)).ConfigureAwait(false); + ver2.Should().Be.EqualTo(owned); + ver2.Referencing.Should().Have.SameValuesAs(owning2); + } + + [Test] + public async Task VerifyHistoryOfOwning1Async() + { + var ver1 = new ManyToOneOwning {Data = "data1", Id = owning1Id}; + (await (AuditReader().FindAsync(owning1Id, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + } + + [Test] + public async Task VerifyHistoryOfOwning2Async() + { + var owned = new OneToManyOwned {Data = "data", Id = ownedId}; + var owning1 = new ManyToOneOwning {Data = "data2", Id = owning2Id, References = owned}; + var owning3 = new ManyToOneOwning {Data = "data2modified", Id = owning2Id, References = owned}; + + var ver1 = await (AuditReader().FindAsync(owning2Id, 1)).ConfigureAwait(false); + var ver3 = await (AuditReader().FindAsync(owning2Id, 3)).ConfigureAwait(false); + + ver1.Should().Be.EqualTo(owning1); + ver1.References.Id.Should().Be.EqualTo(owned.Id); + ver3.Should().Be.EqualTo(owning3); + ver3.References.Id.Should().Be.EqualTo(owned.Id); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ManyToOne/UniDirectional/RelationNotAuditedTargetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToOne/UniDirectional/RelationNotAuditedTargetTest.cs new file mode 100644 index 00000000..9e8f04a3 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ManyToOne/UniDirectional/RelationNotAuditedTargetTest.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.ManyToOne.UniDirectional; +using NHibernate.Proxy; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.ManyToOne.UniDirectional +{ + using System.Threading.Tasks; + public partial class RelationNotAuditedTargetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(TargetNotAuditedEntity), tnae1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(TargetNotAuditedEntity), tnae2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryNae1Async() + { + // load original "tnae1" TargetNotAuditedEntity to force load "str1" UnversionedStrTestEntity as Proxy + var original = await (Session.GetAsync(tnae1_id)).ConfigureAwait(false); + + var uste1 = await (Session.GetAsync(uste1_id)).ConfigureAwait(false); + var uste2 = await (Session.GetAsync(uste2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(tnae1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(tnae1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(tnae1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(tnae1_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(uste1, rev1.Reference); + Assert.AreEqual(uste2, rev2.Reference); + Assert.AreEqual(uste2, rev3.Reference); + Assert.AreEqual(uste1, rev4.Reference); + + Assert.IsTrue(original.Reference is INHibernateProxy); + Assert.AreEqual(typeof(UnversionedStrTestEntity), await (NHibernateUtil.GetClassAsync(original.Reference)).ConfigureAwait(false)); + Assert.AreEqual(typeof(UnversionedStrTestEntity), NHibernateProxyHelper.GetClassWithoutInitializingProxy(rev1.Reference)); + Assert.AreEqual(typeof(UnversionedStrTestEntity), await (NHibernateUtil.GetClassAsync(rev1.Reference)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryNae2Async() + { + var uste1 = await (Session.GetAsync(uste1_id)).ConfigureAwait(false); + var uste2 = await (Session.GetAsync(uste2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(tnae2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(tnae2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(tnae2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(tnae2_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(uste2, rev1.Reference); + Assert.AreEqual(uste1, rev2.Reference); + Assert.AreEqual(uste2, rev3.Reference); + Assert.AreEqual(uste1, rev4.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Merge/AddDelTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Merge/AddDelTest.cs new file mode 100644 index 00000000..35b2d213 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Merge/AddDelTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Merge +{ + using System.Threading.Tasks; + public partial class AddDelTest : TestBase + { + + [Test] + public async Task ShouldNotHaveCreatedRevisionForEntityInRevision2Async() + { + (await (AuditReader().GetRevisionsAsync(typeof(GivenIdStrEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 3); + } + + [Test] + public async Task ShouldHaveCorrectHistoryAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(new GivenIdStrEntity {Id = id, Data = "data"}); + (await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false)) + .Should().Be.EqualTo(new GivenIdStrEntity { Id = id, Data = "modified data" }); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/AbstractModifiedFlagsEntityTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/AbstractModifiedFlagsEntityTest.cs new file mode 100644 index 00000000..552f5411 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/AbstractModifiedFlagsEntityTest.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public abstract partial class AbstractModifiedFlagsEntityTest : TestBase + { + + protected Task QueryForPropertyHasChangedAsync(System.Type type, object id, params string[] propertyNames) + { + try + { + var query = createForRevisionQuery(type, id, false); + addHasChangedProperties(query, propertyNames); + return query.GetResultListAsync(); + } + catch (System.Exception ex) + { + return Task.FromException(ex); + } + } + + protected Task QueryForPropertyHasChangedWithDeletedAsync(System.Type type, object id, params string[] propertyNames) + { + try + { + var query = createForRevisionQuery(type, id, true); + addHasChangedProperties(query, propertyNames); + return query.GetResultListAsync(); + } + catch (System.Exception ex) + { + return Task.FromException(ex); + } + } + + protected Task QueryForPropertyHasNotChangedAsync(System.Type type, object id, params string[] propertyNames) + { + try + { + var query = createForRevisionQuery(type, id, false); + addHasNotChangedProperties(query, propertyNames); + return query.GetResultListAsync(); + } + catch (System.Exception ex) + { + return Task.FromException(ex); + } + } + + protected Task QueryForPropertyHasNotChangedWithDeletedAsync(System.Type type, object id, params string[] propertyNames) + { + try + { + var query = createForRevisionQuery(type, id, true); + addHasNotChangedProperties(query, propertyNames); + return query.GetResultListAsync(); + } + catch (System.Exception ex) + { + return Task.FromException(ex); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAPITest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAPITest.cs new file mode 100644 index 00000000..a946518b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAPITest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Integration.AuditReader; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedAPITest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedCriteriaAsync() + { + var list = await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (AuditedTestEntity), true, true) + .Add(AuditEntity.Property("Data").HasChanged()).GetResultListAsync()).ConfigureAwait(false); + list.Should().Have.Count.EqualTo(2); + list[0].Data.Should().Be.EqualTo("str1"); + list[1].Data.Should().Be.EqualTo("str2"); + } + + [Test] + public async Task VerifyHasNotChangedCriteriaAsync() + { + var list = await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (AuditedTestEntity), true, true) + .Add(AuditEntity.Property("Data").HasNotChanged()).GetResultListAsync()).ConfigureAwait(false); + list.Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAuditedManyToManyRemovalTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAuditedManyToManyRemovalTest.cs new file mode 100644 index 00000000..f84aca3d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAuditedManyToManyRemovalTest.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.ModifiedFlags.Entities.ManyToMany; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedAuditedManyToManyRemovalTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task ShouldNotThrowAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Professor), professorId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof(Student), studentId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAuditedManyToManyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAuditedManyToManyTest.cs new file mode 100644 index 00000000..f25bfd4f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedAuditedManyToManyTest.cs @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Integration.EntityNames.ManyToManyAudited; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedAuditedManyToManyTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedPerson1Async() + { + (await (AuditReader().CreateQuery().ForRevisionsOfEntity("Personaje", false, false) + .Add(AuditEntity.Id().Eq(idPers1)) + .Add(AuditEntity.Property("Cars").HasChanged()) + .GetResultListAsync()).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + + (await (AuditReader().CreateQuery().ForRevisionsOfEntity("Personaje", false, false) + .Add(AuditEntity.Id().Eq(idPers1)) + .Add(AuditEntity.Property("Cars").HasNotChanged()) + .GetResultListAsync()).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(2); + } + + [Test] + public async Task VerifyHasChangedPerson2Async() + { + (await (AuditReader().CreateQuery().ForRevisionsOfEntity("Personaje", false, false) + .Add(AuditEntity.Id().Eq(idPers2)) + .Add(AuditEntity.Property("Cars").HasChanged()) + .GetResultListAsync()).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2); + + (await (AuditReader().CreateQuery().ForRevisionsOfEntity("Personaje", false, false) + .Add(AuditEntity.Id().Eq(idPers2)) + .Add(AuditEntity.Property("Cars").HasNotChanged()) + .GetResultListAsync()).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + + [Test] + public async Task VerifyHasChangedCar1Async() + { + var list = (await (AuditReader().CreateQuery().ForHistoryOf(false) + .Add(AuditEntity.Id().Eq(idCar1)) + .Add(AuditEntity.Property("Owners").HasChanged()) + .ResultsAsync()).ConfigureAwait(false)).ToList(); + list.Should().Have.Count.EqualTo(1); + list.ExtractRevisionNumbersFromHistory().Should().Have.SameSequenceAs(1); + + var list2 = await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof(Car), false, false) + .Add(AuditEntity.Id().Eq(idCar1)) + .Add(AuditEntity.Property("Owners").HasNotChanged()) + .GetResultListAsync()).ConfigureAwait(false); + list2.Count.Should().Be.EqualTo(0); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedBidirectional2Test.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedBidirectional2Test.cs new file mode 100644 index 00000000..146b0b11 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedBidirectional2Test.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedBidirectional2Test : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (BiRefEdEntity), ed1Id, "Referencing")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(2, 3, 4); + + (await (QueryForPropertyHasChangedAsync(typeof (BiRefEdEntity), ed2Id, "Referencing")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(4); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedChildAuditingTest.cs new file mode 100644 index 00000000..2a94e083 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedChildAuditingTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedChildAuditingTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyChildHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(ChildEntity), id, "Data")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1, 2); + (await (QueryForPropertyHasChangedAsync(typeof(ChildEntity), id, "Number")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1, 2); + (await (QueryForPropertyHasNotChangedAsync(typeof(ChildEntity), id, "Data")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Be.Empty(); + (await (QueryForPropertyHasNotChangedAsync(typeof(ChildEntity), id, "Number")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Be.Empty(); + } + + [Test] + public async Task VerifyParentHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(ParentEntity), id, "Data")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1, 2); + (await (QueryForPropertyHasNotChangedAsync(typeof(ParentEntity), id, "Data")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedChildReferencingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedChildReferencingTest.cs new file mode 100644 index 00000000..79a58fbb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedChildReferencingTest.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedChildReferencingTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyReferencedEntityHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (ReferencedToChildEntity), id1, "Referencing")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(2, 3); + (await (QueryForPropertyHasNotChangedAsync(typeof(ReferencedToChildEntity), id1, "Referencing")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1); + (await (QueryForPropertyHasChangedAsync(typeof(ReferencedToChildEntity), id2, "Referencing")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(3); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentCollectionTest.cs new file mode 100644 index 00000000..c80cbb25 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentCollectionTest.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Entities.Components; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedComponentCollectionTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedEleAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (EmbeddableListEntity1), ele1Id, "ComponentList")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 3, 4, 5); + + (await (QueryForPropertyHasChangedAsync(typeof (EmbeddableListEntity1), ele1Id, "OtherData")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 6); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentMapKeyTest.cs new file mode 100644 index 00000000..9ee4b978 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentMapKeyTest.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Components; +using NHibernate.Envers.Tests.Integration.Collection.MapKey; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedComponentMapKeyTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedMapEntityAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(ComponentMapKeyEntity), cmke_id, "IdMap")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1, 2); + (await (QueryForPropertyHasNotChangedAsync(typeof(ComponentMapKeyEntity), cmke_id, "IdMap")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Be.Empty(); + } + + [Test] + public async Task VerifyHasChangedComponentEntityAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(ComponentTestEntity), cte1_id, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1); + (await (QueryForPropertyHasNotChangedAsync(typeof (ComponentTestEntity), cte1_id, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Be.Empty(); + (await (QueryForPropertyHasChangedAsync(typeof(ComponentTestEntity), cte2_id, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1); + (await (QueryForPropertyHasNotChangedAsync(typeof(ComponentTestEntity), cte2_id, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision().Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentsTest.cs new file mode 100644 index 00000000..4d423bd7 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedComponentsTest.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Components; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedComponentsTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public void VerifyHasChangedNotAuditedAsync() + { + Assert.ThrowsAsync(() => + QueryForPropertyHasChangedAsync(typeof (ComponentTestEntity), id1, "Comp2") + ); + } + + [Test] + public async Task VerifyHasChangedId1Async() + { + (await (QueryForPropertyHasChangedAsync(typeof (ComponentTestEntity), id1, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2); + + (await (QueryForPropertyHasNotChangedAsync(typeof(ComponentTestEntity), id1, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + + [Test] + public async Task VerifyHasChangedId2Async() + { + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof(ComponentTestEntity), id2, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 4); + + (await (QueryForPropertyHasNotChangedWithDeletedAsync(typeof(ComponentTestEntity), id2, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + + [Test] + public async Task VerifyHasChangedId3Async() + { + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof(ComponentTestEntity), id3, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 3); + + (await (QueryForPropertyHasNotChangedWithDeletedAsync(typeof(ComponentTestEntity), id3, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + + [Test] + public async Task VerifyHasChangedId4Async() + { + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof(ComponentTestEntity), id4, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(2, 3); + + (await (QueryForPropertyHasNotChangedWithDeletedAsync(typeof(ComponentTestEntity), id4, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedCompositeCustomTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedCompositeCustomTest.cs new file mode 100644 index 00000000..9b4f28f2 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedCompositeCustomTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.CustomType; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedCompositeCustomTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (CompositeCustomTypeEntity), id, "Component")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 3); + + (await (QueryForPropertyHasNotChangedAsync(typeof(CompositeCustomTypeEntity), id, "Component")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedDoubleJoinColumnBidirectionalListTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedDoubleJoinColumnBidirectionalListTest.cs new file mode 100644 index 00000000..99d98fe6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedDoubleJoinColumnBidirectionalListTest.cs @@ -0,0 +1,91 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedDoubleJoinColumnBidirectionalListTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyOwnerHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (DoubleListJoinColumnBidirectionalRefEdEntity1), ed1_1_id, "Owner")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 4); + (await (QueryForPropertyHasNotChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity1), ed1_1_id, "Owner")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(3); + (await (QueryForPropertyHasChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity1), ed1_2_id, "Owner")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 4); + (await (QueryForPropertyHasNotChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity1), ed1_2_id, "Owner")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + + [Test] + public async Task VerifyOwnerSecEntityHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity2), ed2_1_id, "Owner")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 4); + (await (QueryForPropertyHasNotChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity2), ed2_1_id, "Owner")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + (await (QueryForPropertyHasChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity2), ed2_2_id, "Owner")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2); + (await (QueryForPropertyHasNotChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity2), ed2_2_id, "Owner")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(3); + } + + [Test] + public async Task VerifyReferences1HasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing1_id, "References1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 4); + (await (QueryForPropertyHasChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing2_id, "References1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 4); + (await (QueryForPropertyHasNotChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing1_id, "References1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + (await (QueryForPropertyHasNotChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing2_id, "References1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + + [Test] + public async Task VerifyReferences2HasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing1_id, "References2")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 4); + (await (QueryForPropertyHasChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing2_id, "References2")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 4); + (await (QueryForPropertyHasNotChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing1_id, "References2")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + (await (QueryForPropertyHasNotChangedAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing2_id, "References2")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedEnumSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedEnumSetTest.cs new file mode 100644 index 00000000..0834a92b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedEnumSetTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedEnumSetTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (EnumSetEntity), id, "Enums1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 3); + (await (QueryForPropertyHasChangedAsync(typeof(EnumSetEntity), id, "Enums2")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + (await (QueryForPropertyHasNotChangedAsync(typeof (EnumSetEntity), id, "Enums1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + (await (QueryForPropertyHasNotChangedAsync(typeof(EnumSetEntity), id, "Enums2")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(2, 3); + + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedForDefaultNotUsingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedForDefaultNotUsingTest.cs new file mode 100644 index 00000000..c68c09a7 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedForDefaultNotUsingTest.cs @@ -0,0 +1,120 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Components; +using NHibernate.Envers.Tests.Integration.ModifiedFlags.Entities; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedForDefaultNotUsingTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (PartialModifiedFlagsEntity), entityId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3, 4, 5, 6, 7, 8, 10, 11); + } + + [Test] + public async Task VerifyHasChangedDataAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (PartialModifiedFlagsEntity), entityId, "Data")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(2); + } + + [Test] + public async Task VerifyHasChangedComp1Async() + { + (await (QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(3); + } + + [Test] + public void VerifyHasChangedComp2Async() + { + Assert.ThrowsAsync(() => + QueryForPropertyHasChangedAsync(typeof (PartialModifiedFlagsEntity), entityId, "Comp2") + ); + } + + [Test] + public async Task VerifyHasChangedReferencingAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "Referencing")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(5, 6); + } + + [Test] + public void VerifyHasChangedReferencing2Async() + { + Assert.ThrowsAsync(() => + QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "Referencing2") + ); + } + + [Test] + public async Task VerifyHasChangedStringSetAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "StringSet")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 7, 8); + } + + [Test] + public async Task VerifyHasChangedStringMapAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "StringMap")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 8); + } + + [Test] + public async Task VerifyHasChangedStringSetAndMapAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "StringSet", "StringMap")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 8); + } + + [Test] + public async Task VerifyHasChangedEntitiesSetAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "EntitiesSet")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 10, 11); + } + + [Test] + public async Task VerifyHasChangedEntitiesMapAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "EntitiesMap")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 11); + } + + [Test] + public async Task VerifyHasChangedEntitiesSetAndMapAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(PartialModifiedFlagsEntity), entityId, "EntitiesSet", "EntitiesMap")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 11); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedIdMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedIdMapKeyTest.cs new file mode 100644 index 00000000..c909cd3a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedIdMapKeyTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Integration.Collection.MapKey; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedIdMapKeyTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (IdMapKeyEntity), id, "IdMap")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2); + (await (QueryForPropertyHasNotChangedAsync(typeof(IdMapKeyEntity), id, "IdMap")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedInsertUpdateSameTransactionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedInsertUpdateSameTransactionTest.cs new file mode 100644 index 00000000..80fe984e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedInsertUpdateSameTransactionTest.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.Basic; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedInsertUpdateSameTransactionTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyPropertyChangedInsertUpdateSameTransactionAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(BasicTestEntity1), 1, "Long1")).ConfigureAwait(false)).Count + .Should().Be.EqualTo(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedManualFlushTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedManualFlushTest.cs new file mode 100644 index 00000000..36450d02 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedManualFlushTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.Basic; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedManualFlushTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task ShouldHaveChangedOnDoubleFlushAsync() + { + var list = await (QueryForPropertyHasChangedAsync(typeof (BasicTestEntity1), id, "Str1")).ConfigureAwait(false); + list.Count.Should().Be.EqualTo(2); + list.ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1, 2); + + list = await (QueryForPropertyHasChangedAsync(typeof (BasicTestEntity1), id, "Long1")).ConfigureAwait(false); + list.Count.Should().Be.EqualTo(2); + list.ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1, 2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedManyToOneInComponentTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedManyToOneInComponentTest.cs new file mode 100644 index 00000000..ffbf8bf8 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedManyToOneInComponentTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Components.Relations; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedManyToOneInComponentTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (ManyToOneComponentTestEntity), id, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(2, 3); + (await (QueryForPropertyHasNotChangedAsync(typeof(ManyToOneComponentTestEntity), id, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedMergeTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedMergeTest.cs new file mode 100644 index 00000000..a2ad678e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedMergeTest.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedMergeTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyOneToManyInsertChildUpdateParentAsync() + { + var list = await (QueryForPropertyHasChangedAsync(typeof (CollectionRefEdEntity), parentId, "Data")).ConfigureAwait(false); + list.Count.Should().Be.EqualTo(2); + list.ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1, 2); + + list = await (QueryForPropertyHasChangedAsync(typeof(CollectionRefEdEntity), parentId, "Reffering")).ConfigureAwait(false); + list.Count.Should().Be.EqualTo(2); + list.ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(1, 2); + + list = await (QueryForPropertyHasChangedAsync(typeof(CollectionRefIngEntity), childId, "Reference")).ConfigureAwait(false); + list.Count.Should().Be.EqualTo(1); + list.ExtractRevisionNumbersFromRevision().Should().Have.SameSequenceAs(2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedNotOwnedBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedNotOwnedBidirectionalTest.cs new file mode 100644 index 00000000..8df7356e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedNotOwnedBidirectionalTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedNotOwnedBidirectionalTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyReferencedEntityHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (PersonalContact), pc_id, "Addresses")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2); + (await (QueryForPropertyHasChangedAsync(typeof(Address), a1_id, "Contact")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + (await (QueryForPropertyHasChangedAsync(typeof(Address), a2_id, "Contact")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(2); + + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedNullPropertiesTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedNullPropertiesTest.cs new file mode 100644 index 00000000..ab339e9d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedNullPropertiesTest.cs @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Integration.Basic; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedNullPropertiesTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof (BasicTestEntity1), id1, "Str1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 3); + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof(BasicTestEntity1), id1, "Long1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + // str1 property was null before insert and after insert so in a way it didn't change - is it a good way to go? + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof(BasicTestEntity1), id2, "Str1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(4); + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof(BasicTestEntity1), id2, "Long1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(2); + + (await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (BasicTestEntity1), false, true) + .Add(AuditEntity.Property("Str1").HasChanged()) + .Add(AuditEntity.Property("Long1").HasChanged()) + .GetResultListAsync()).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedOneToManyInComponentTEst.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedOneToManyInComponentTEst.cs new file mode 100644 index 00000000..3e5bcfe9 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedOneToManyInComponentTEst.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Components.Relations; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedOneToManyInComponentTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (OneToManyComponentTestEntity), id, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(2, 3); + + (await (QueryForPropertyHasNotChangedAsync(typeof (OneToManyComponentTestEntity), id, "Comp1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedStringMapTEst.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedStringMapTEst.cs new file mode 100644 index 00000000..0683acc2 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedStringMapTEst.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedStringMapTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (StringMapEntity), sme1_id, "Strings")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2, 3); + (await (QueryForPropertyHasChangedAsync(typeof(StringMapEntity), sme2_id, "Strings")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 3); + (await (QueryForPropertyHasNotChangedAsync(typeof (StringMapEntity), sme1_id, "Strings")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + (await (QueryForPropertyHasNotChangedAsync(typeof (StringMapEntity), sme2_id, "Strings")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); // in rev 2 there was no version generated for sme2_id + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedStringSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedStringSetTest.cs new file mode 100644 index 00000000..d8500fd5 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedStringSetTest.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedStringSetTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof(StringSetEntity), sse1_id, "Strings")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2); + (await (QueryForPropertyHasChangedAsync(typeof(StringSetEntity), sse2_id, "Strings")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 3); + (await (QueryForPropertyHasNotChangedAsync(typeof (StringSetEntity), sse1_id, "Strings")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + (await (QueryForPropertyHasNotChangedAsync(typeof(StringSetEntity), sse2_id, "Strings")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedUnversionedPropertiesTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedUnversionedPropertiesTest.cs new file mode 100644 index 00000000..3cf08362 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/HasChangedUnversionedPropertiesTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.Basic; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class HasChangedUnversionedPropertiesTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedQueryAsync() + { + (await (QueryForPropertyHasChangedAsync(typeof (BasicTestEntity2), id, "Str1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public void ShouldThrowExceptionOnHasChangedQueryAsync() + { + Assert.ThrowsAsync(() => + QueryForPropertyHasChangedWithDeletedAsync(typeof (BasicTestEntity2), id, "Str2")); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/ModifiedFlagSuffixTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/ModifiedFlagSuffixTest.cs new file mode 100644 index 00000000..5f74d1d7 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/ModifiedFlags/ModifiedFlagSuffixTest.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Integration.Basic; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class ModifiedFlagSuffixTest : AbstractModifiedFlagsEntityTest + { + + [Test] + public async Task VerifyHasChangedAsync() + { + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof (BasicTestEntity1), id, "Str1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + (await (QueryForPropertyHasChangedWithDeletedAsync(typeof(BasicTestEntity1), id, "Long1")).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + (await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (BasicTestEntity1), false, true) + .Add(AuditEntity.Property("Str1").HasChanged()) + .Add(AuditEntity.Property("Long1").HasChanged()) + .GetResultListAsync()).ConfigureAwait(false)) + .ExtractRevisionNumbersFromRevision() + .Should().Have.SameSequenceAs(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/MultipleRelations/MultipleAssociationsTest .cs b/Src/NHibernate.Envers.Tests/Async/Integration/MultipleRelations/MultipleAssociationsTest .cs new file mode 100644 index 00000000..5367eab9 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/MultipleRelations/MultipleAssociationsTest .cs @@ -0,0 +1,125 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.MultipleRelations +{ + using System.Threading.Tasks; + public partial class MultipleAssociationsTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Person), lukaszId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 4, 5); + (await (AuditReader().GetRevisionsAsync(typeof(Person), kingaId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 5); + (await (AuditReader().GetRevisionsAsync(typeof(Address), warsawId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 5); + (await (AuditReader().GetRevisionsAsync(typeof(Address), cracowId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(2, 3); + } + + [Test] + public async Task VerifyHistoryOfLukaszAsync() + { + var lukasz = new Person {Id = lukaszId, Name = "Lukasz"}; + var warsaw = new Address {Id = warsawId, City = "Warsaw"}; + lukasz.Addresses.Add(warsaw); + lukasz.OwnedAddresses.Add(warsaw); + + var ver1 = await (AuditReader().FindAsync(lukaszId, 1)).ConfigureAwait(false); + lukasz.Should().Be.EqualTo(ver1); + lukasz.Addresses.Should().Have.SameValuesAs(ver1.Addresses); + lukasz.OwnedAddresses.Should().Have.SameValuesAs(ver1.OwnedAddresses); + + lukasz.Name = "Lucas"; + + var ver4 = await (AuditReader().FindAsync(lukaszId, 4)).ConfigureAwait(false); + lukasz.Should().Be.EqualTo(ver4); + + lukasz.OwnedAddresses.Remove(warsaw); + + var ver5 = await (AuditReader().FindAsync(lukaszId, 5)).ConfigureAwait(false); + lukasz.OwnedAddresses.Should().Have.SameValuesAs(ver5.OwnedAddresses); + } + + [Test] + public async Task VerifyHistoryOfKingaAsync() + { + var kinga = new Person { Id = kingaId, Name = "Kinga" }; + var warsaw = new Address { Id = warsawId, City = "Warsaw" }; + kinga.Addresses.Add(warsaw); + + var ver1 = await (AuditReader().FindAsync(kingaId, 1)).ConfigureAwait(false); + kinga.Should().Be.EqualTo(ver1); + kinga.Addresses.Should().Have.SameValuesAs(ver1.Addresses); + kinga.OwnedAddresses.Should().Have.SameValuesAs(ver1.OwnedAddresses); + + var cracow = new Address {Id = cracowId, City = "Cracow"}; + kinga.OwnedAddresses.Add(cracow); + kinga.Addresses.Add(cracow); + + var ver2 = await (AuditReader().FindAsync(kingaId, 2)).ConfigureAwait(false); + kinga.Should().Be.EqualTo(ver2); + kinga.Addresses.Should().Have.SameValuesAs(ver2.Addresses); + kinga.OwnedAddresses.Should().Have.SameValuesAs(ver2.OwnedAddresses); + + kinga.OwnedAddresses.Add(warsaw); + cracow.City = "Krakow"; + + var ver5 = await (AuditReader().FindAsync(kingaId, 5)).ConfigureAwait(false); + kinga.Addresses.Should().Have.SameValuesAs(ver5.Addresses); + kinga.OwnedAddresses.Should().Have.SameValuesAs(ver5.OwnedAddresses); + } + + [Test] + public async Task VerifyHistoryOfCracowAsync() + { + var cracow = new Address { Id = cracowId, City = "Cracow" }; + var kinga = new Person { Id = kingaId, Name = "Kinga" }; + cracow.Tenants.Add(kinga); + cracow.Landlord = kinga; + + var ver2 = await (AuditReader().FindAsync
(cracowId, 2)).ConfigureAwait(false); + ver2.Should().Be.EqualTo(cracow); + ver2.Tenants.Should().Have.SameValuesAs(cracow.Tenants); + ver2.Landlord.Id.Should().Be.EqualTo(cracow.Landlord.Id); + + cracow.City = "Krakow"; + var ver3 = await (AuditReader().FindAsync
(cracowId, 3)).ConfigureAwait(false); + ver3.Should().Be.EqualTo(cracow); + } + + [Test] + public async Task VerifyHistoryOfWarsawAsync() + { + var warsaw = new Address { Id = warsawId, City = "Warsaw" }; + var kinga = new Person { Id = kingaId, Name = "Kinga" }; + var lukasz = new Person { Id = lukaszId, Name = "Lukasz" }; + warsaw.Tenants.Add(kinga); + warsaw.Tenants.Add(lukasz); + warsaw.Landlord = lukasz; + + var ver1 = await (AuditReader().FindAsync
(warsawId, 1)).ConfigureAwait(false); + ver1.Should().Be.EqualTo(warsaw); + ver1.Tenants.Should().Have.SameValuesAs(warsaw.Tenants); + ver1.Landlord.Id.Should().Be.EqualTo(warsaw.Landlord.Id); + + warsaw.Landlord = kinga; + + var ver5 = await (AuditReader().FindAsync
(warsawId, 5)).ConfigureAwait(false); + ver5.Landlord.Id.Should().Be.EqualTo(warsaw.Landlord.Id); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Naming/BasicNamingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/BasicNamingTest.cs new file mode 100644 index 00000000..76c33675 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/BasicNamingTest.cs @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Naming +{ + using System.Threading.Tasks; + public partial class BasicNamingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(NamingTestEntity1), id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(NamingTestEntity1), id2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new NamingTestEntity1 {Id = id1, Data = "data1"}; + var ver2 = new NamingTestEntity1 {Id = id1, Data = "data1'"}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId2Async() + { + var ver1 = new NamingTestEntity1 { Id = id2, Data = "data2" }; + var ver2 = new NamingTestEntity1 { Id = id2, Data = "data2'" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id2, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id2, 3)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Naming/EstonianTableAliasTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/EstonianTableAliasTest.cs new file mode 100644 index 00000000..fea6c020 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/EstonianTableAliasTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using ee.Estonia.Entities; +using NHibernate.Envers.Configuration.Attributes; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Naming +{ + using System.Threading.Tasks; + public partial class EstonianTableAliasTest : TestBase + { + + [Test] + public async Task VerifyAuditChildTableAliasAsync() + { + var parent = new Parent { Data = "data", Id = parentId }; + var child = new Child { Data = "child", Id = childId }; + + var ver1 = await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false); + + ver1.Should().Be.EqualTo(parent); + ver1.Collection.Should().Have.SameValuesAs(child); + } + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Naming/Ids/JoinEmbIdNamingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/Ids/JoinEmbIdNamingTest.cs new file mode 100644 index 00000000..5d555657 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/Ids/JoinEmbIdNamingTest.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Naming.Ids +{ + using System.Threading.Tasks; + public partial class JoinEmbIdNamingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(JoinEmbIdNamingRefEdEntity), ed_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(JoinEmbIdNamingRefEdEntity), ed_id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(JoinEmbIdNamingRefIngEntity), ing_id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ver1 = new JoinEmbIdNamingRefEdEntity { Id = ed_id1, Data = "data1" }; + + var rev1 = await (AuditReader().FindAsync(ed_id1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed_id1, 2)).ConfigureAwait(false); + + Assert.AreEqual(ver1, rev1); + Assert.AreEqual(ver1, rev2); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ver1 = new JoinEmbIdNamingRefEdEntity { Id = ed_id2, Data = "data2" }; + + var rev1 = await (AuditReader().FindAsync(ed_id2, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed_id2, 2)).ConfigureAwait(false); + + Assert.AreEqual(ver1, rev1); + Assert.AreEqual(ver1, rev2); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ver1 = new JoinEmbIdNamingRefIngEntity { Id = ing_id1, Data = "x", Reference = null }; + var ver2 = new JoinEmbIdNamingRefIngEntity { Id = ing_id1, Data = "y", Reference = null }; + + var rev1 = await (AuditReader().FindAsync(ing_id1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing_id1, 2)).ConfigureAwait(false); + + Assert.AreEqual(ver1, rev1); + Assert.AreEqual(ver2, rev2); + + Assert.AreEqual(new JoinEmbIdNamingRefEdEntity { Id = ed_id1, Data = "data1" }, rev1.Reference); + Assert.AreEqual(new JoinEmbIdNamingRefEdEntity { Id = ed_id2, Data = "data2" }, rev2.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Naming/JoinNamingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/JoinNamingTest.cs new file mode 100644 index 00000000..b77a9127 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/JoinNamingTest.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Mapping; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Naming +{ + using System.Threading.Tasks; + public partial class JoinNamingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(JoinNamingRefEdEntity), ed_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(JoinNamingRefEdEntity), ed_id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(JoinNamingRefIngEntity), ing_id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEdId1Async() + { + var ver1 = new JoinNamingRefEdEntity {Id = ed_id1, Data = "data1"}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(ed_id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(ed_id1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEdId2Async() + { + var ver1 = new JoinNamingRefEdEntity { Id = ed_id2, Data = "data2" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(ed_id2, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver1, await (AuditReader().FindAsync(ed_id2, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIngId1Async() + { + var ver1 = new JoinNamingRefIngEntity {Id = ing_id1, Data = "x", Reference = null}; + var ver2 = new JoinNamingRefIngEntity {Id = ing_id1, Data = "y", Reference = null}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(ing_id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(ing_id1, 2)).ConfigureAwait(false)); + + Assert.AreEqual(new JoinNamingRefEdEntity { Id = ed_id1, Data = "data1" }, + (await (AuditReader().FindAsync(ing_id1, 1)).ConfigureAwait(false)).Reference); + Assert.AreEqual(new JoinNamingRefEdEntity { Id = ed_id2, Data = "data2" }, + (await (AuditReader().FindAsync(ing_id1, 2)).ConfigureAwait(false)).Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Naming/OneToManyUniDirectionalNamingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/OneToManyUniDirectionalNamingTest.cs new file mode 100644 index 00000000..8b22ef48 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/OneToManyUniDirectionalNamingTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Naming +{ + using System.Threading.Tasks; + public partial class OneToManyUniDirectionalNamingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(DetachedNamingTestEntity), uni1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str1_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfUniId1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(uni1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(uni1_id, 2)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Collection); + CollectionAssert.AreEquivalent(new[] { str1}, rev2.Collection); + Assert.AreEqual("data1", rev1.Data); + Assert.AreEqual("data1", rev2.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Naming/Quotation/QuotedFieldsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/Quotation/QuotedFieldsTest.cs new file mode 100644 index 00000000..706c9c21 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/Quotation/QuotedFieldsTest.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Naming.Quotation +{ + using System.Threading.Tasks; + public partial class QuotedFieldsTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(QuotedFieldsEntity), qfeId1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof(QuotedFieldsEntity), qfeId2)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 3); + } + + [Test] + public async Task VerifyHistoryOf1Async() + { + var ver1 = new QuotedFieldsEntity { Id = qfeId1, Data1 = "data1", Data2 = 1 }; + var ver2 = new QuotedFieldsEntity { Id = qfeId1, Data1 = "data changed", Data2 = 1 }; + + (await (AuditReader().FindAsync(qfeId1, 1)).ConfigureAwait(false)).Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(qfeId1, 2)).ConfigureAwait(false)).Should().Be.EqualTo(ver2); + (await (AuditReader().FindAsync(qfeId1, 3)).ConfigureAwait(false)).Should().Be.EqualTo(ver2); + } + + [Test] + public async Task VerifyHistoryOf2Async() + { + var ver1 = new QuotedFieldsEntity { Id = qfeId2, Data1 = "data2", Data2 = 2 }; + var ver2 = new QuotedFieldsEntity { Id = qfeId2, Data1 = "data2", Data2 = 3 }; + + (await (AuditReader().FindAsync(qfeId2, 1)).ConfigureAwait(false)).Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(qfeId2, 2)).ConfigureAwait(false)).Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(qfeId2, 3)).ConfigureAwait(false)).Should().Be.EqualTo(ver2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Naming/VersionsJoinTableNamingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/VersionsJoinTableNamingTest.cs new file mode 100644 index 00000000..46366c4d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/VersionsJoinTableNamingTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Naming +{ + using System.Threading.Tasks; + public partial class VersionsJoinTableNamingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(VersionsJoinTableTestEntity), uni1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str1_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfUniId1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(uni1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(uni1_id, 2)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Collection); + CollectionAssert.AreEquivalent(new[] { str1 }, rev2.Collection); + Assert.AreEqual("data1", rev1.Data); + Assert.AreEqual("data1", rev2.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Naming/VersionsJoinTableRangeComponentNamingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/VersionsJoinTableRangeComponentNamingTest.cs new file mode 100644 index 00000000..91a09799 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Naming/VersionsJoinTableRangeComponentNamingTest.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Components; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Naming +{ + using System.Threading.Tasks; + public partial class VersionsJoinTableRangeComponentNamingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(VersionsJoinTableRangeComponentTestEntity), vjrcte_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(VersionsJoinTableRangeTestEntity), vjtrte_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(VersionsJoinTableRangeTestAlternateEntity), vjtrtae_id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryUfUniId1Async() + { + var vjtrte = await (Session.GetAsync(vjtrte_id)).ConfigureAwait(false); + var vjtrtae = await (Session.GetAsync(vjtrtae_id1)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(vjrcte_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(vjrcte_id, 2)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Component1.Range); + CollectionAssert.IsEmpty(rev1.Component2.Range); + CollectionAssert.AreEquivalent(new[] { vjtrte }, rev2.Component1.Range); + CollectionAssert.AreEquivalent(new[] { vjtrtae }, rev2.Component2.Range); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/NotInsertable/ManyToOne/ManyToOneNotInsertableTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/NotInsertable/ManyToOne/ManyToOneNotInsertableTest.cs new file mode 100644 index 00000000..af4128fc --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/NotInsertable/ManyToOne/ManyToOneNotInsertableTest.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.NotInsertable.ManyToOne +{ + using System.Threading.Tasks; + public partial class ManyToOneNotInsertableTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(NotInsertableEntityType), type_id1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(NotInsertableEntityType), type_id2)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(ManyToOneNotInsertableEntity), mto_id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = await (AuditReader().FindAsync(mto_id1, 1)).ConfigureAwait(false); + var ver2 = await (AuditReader().FindAsync(mto_id1, 2)).ConfigureAwait(false); + var ver3 = await (AuditReader().FindAsync(mto_id1, 3)).ConfigureAwait(false); + + var type1 = await (Session.GetAsync(type_id1)).ConfigureAwait(false); + var type2 = await (Session.GetAsync(type_id2)).ConfigureAwait(false); + + Assert.IsNull(ver1); + Assert.AreEqual(type1, ver2.Type); + Assert.AreEqual(type2, ver3.Type); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/NotInsertable/NotInsertableTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/NotInsertable/NotInsertableTest.cs new file mode 100644 index 00000000..93eb99c6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/NotInsertable/NotInsertableTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.NotInsertable +{ + using System.Threading.Tasks; + public partial class NotInsertableTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(NotInsertableTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new NotInsertableTestEntity { Id = id1, Data = "data1", DataCopy = "data1" }; + var ver2 = new NotInsertableTestEntity { Id = id1, Data = "data2", DataCopy = "data2" }; + + var rev1 = await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false); + + Assert.AreEqual(ver1, rev1); + Assert.AreEqual(ver2, rev2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/NotUpdatable/PropertyNotUpdatableTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/NotUpdatable/PropertyNotUpdatableTest.cs new file mode 100644 index 00000000..c691925b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/NotUpdatable/PropertyNotUpdatableTest.cs @@ -0,0 +1,76 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NHibernate.Envers.Configuration; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.NotUpdatable +{ + using System.Threading.Tasks; + public partial class PropertyNotUpdatableTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (PropertyNotUpdatableEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3, 4); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new PropertyNotUpdatableEntity + { + Id = id, + Data = "data", + ConstantData1 = "constant data 1", + ConstantData2 = "constant data 2" + }; + var ver2 = new PropertyNotUpdatableEntity + { + Id = id, + Data = "modified data", + ConstantData1 = "constant data 1", + ConstantData2 = "constant data 2" + }; + var ver3 = new PropertyNotUpdatableEntity + { + Id = id, + Data = "another modified data", + ConstantData1 = "constant data 1", + ConstantData2 = "constant data 2" + }; + + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver2); + (await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver3); + } + + [Test] + public async Task VerifyDeleteStateAsync() + { + var delete = new PropertyNotUpdatableEntity + { + Id = id, + Data = "another modified data", + ConstantData1 = "constant data 1", + ConstantData2 = "constant data 2" + }; + (await (AuditReader().CreateQuery().ForRevisionsOf(true).ResultsAsync()).ConfigureAwait(false)).Last() + .Should().Be.EqualTo(delete); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicCollectionTest.cs new file mode 100644 index 00000000..fce28a2f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicCollectionTest.cs @@ -0,0 +1,91 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany +{ + using System.Threading.Tasks; + public partial class BasicCollectionTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(CollectionRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(CollectionRefEdEntity), ed2_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(CollectionRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(CollectionRefIngEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] {ing1, ing2}, rev1.Reffering); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev2.Reffering); + CollectionAssert.IsEmpty(rev3.Reffering); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Reffering); + CollectionAssert.AreEquivalent(new[] { ing1 }, rev2.Reffering); + CollectionAssert.AreEquivalent(new[] { ing2, ing1 }, rev3.Reffering); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed2, rev2.Reference); + Assert.AreEqual(ed2, rev3.Reference); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed1, rev2.Reference); + Assert.AreEqual(ed2, rev3.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetTest.cs new file mode 100644 index 00000000..65e8eabf --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetTest.cs @@ -0,0 +1,99 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany +{ + using System.Threading.Tasks; + public partial class BasicSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEntity), ed2_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_id, 4)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Reffering); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev2.Reffering); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev3.Reffering); + CollectionAssert.IsEmpty(rev4.Reffering); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_id, 4)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Reffering); + CollectionAssert.IsEmpty(rev2.Reffering); + CollectionAssert.AreEquivalent(new[] { ing1 }, rev3.Reffering); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev4.Reffering); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + + Assert.IsNull(rev1); + Assert.AreEqual(ed1, rev2.Reference); + Assert.AreEqual(ed2, rev3.Reference); + Assert.AreEqual(ed2, rev4.Reference); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + + Assert.IsNull(rev1); + Assert.AreEqual(ed1, rev2.Reference); + Assert.AreEqual(ed1, rev3.Reference); + Assert.AreEqual(ed2, rev4.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetWithEmbIdTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetWithEmbIdTest.cs new file mode 100644 index 00000000..40d55206 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetWithEmbIdTest.cs @@ -0,0 +1,92 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Ids; +using NHibernate.Envers.Tests.Entities.OneToMany.Ids; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany +{ + using System.Threading.Tasks; + public partial class BasicSetWithEmbIdTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEmbIdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEmbIdEntity), ed2_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEmbIdEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEmbIdEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev1.Reffering); + CollectionAssert.AreEquivalent(new[] { ing2 }, rev2.Reffering); + CollectionAssert.IsEmpty(rev3.Reffering); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Reffering); + CollectionAssert.AreEquivalent(new[] { ing1 }, rev2.Reffering); + CollectionAssert.AreEquivalent(new[] { ing1, ing2 }, rev3.Reffering); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed2, rev2.Reference); + Assert.AreEqual(ed2, rev3.Reference); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed1, rev2.Reference); + Assert.AreEqual(ed2, rev3.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetWithNullsDeleteTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetWithNullsDeleteTest.cs new file mode 100644 index 00000000..2b521735 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BasicSetWithNullsDeleteTest.cs @@ -0,0 +1,145 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany +{ + using System.Threading.Tasks; + public partial class BasicSetWithNullsDeleteTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4, 5 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 4 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEntity), ed2_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), ing2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 4 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), ing3_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 5 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), ing4_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = new SetRefIngEntity {Id = ing2_id, Data = "data_ing_2"}; + var ing3 = await (Session.GetAsync(ing3_id)).ConfigureAwait(false); + var ing4 = await (Session.GetAsync(ing4_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ed1_id, 5)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { ing1, ing2, ing3, ing4 }, rev1.Reffering); + CollectionAssert.AreEquivalent(new[] { ing2, ing3, ing4 }, rev2.Reffering); + CollectionAssert.AreEquivalent(new[] { ing3, ing4 }, rev3.Reffering); + CollectionAssert.AreEquivalent(new[] { ing4 }, rev4.Reffering); + Assert.IsNull(rev5); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing3 = await (Session.GetAsync(ing3_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ed2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Reffering); + CollectionAssert.IsEmpty(rev2.Reffering); + CollectionAssert.IsEmpty(rev3.Reffering); + CollectionAssert.AreEquivalent(new[] { ing3 }, rev4.Reffering); + CollectionAssert.AreEquivalent(new[] { ing3 }, rev5.Reffering); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = new SetRefEdEntity {Id = ed1_id, Data = "data_ed_1"}; + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + var rev5= await (AuditReader().FindAsync(ing1_id, 5)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.IsNull(rev2.Reference); + Assert.IsNull(rev3.Reference); + Assert.IsNull(rev4.Reference); + Assert.IsNull(rev5.Reference); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed1 = new SetRefEdEntity { Id = ed1_id, Data = "data_ed_1" }; + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing2_id, 5)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed1, rev2.Reference); + Assert.IsNull(rev3); + Assert.IsNull(rev4); + Assert.IsNull(rev5); + } + + [Test] + public async Task VerifyHistoryOfIng3Async() + { + var ed1 = new SetRefEdEntity { Id = ed1_id, Data = "data_ed_1" }; + var ed2 = new SetRefEdEntity { Id = ed2_id, Data = "data_ed_2" }; + + var rev1 = await (AuditReader().FindAsync(ing3_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing3_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing3_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing3_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing3_id, 5)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed1, rev2.Reference); + Assert.AreEqual(ed1, rev3.Reference); + Assert.AreEqual(ed2, rev4.Reference); + Assert.AreEqual(ed2, rev5.Reference); + } + + [Test] + public async Task VerifyHistoryOfIng4Async() + { + var ed1 = new SetRefEdEntity { Id = ed1_id, Data = "data_ed_1" }; + + var rev1 = await (AuditReader().FindAsync(ing4_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing4_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing4_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing4_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(ing4_id, 5)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed1, rev2.Reference); + Assert.AreEqual(ed1, rev3.Reference); + Assert.AreEqual(ed1, rev4.Reference); + Assert.IsNull(rev5.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BidirectionalMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BidirectionalMapKeyTest.cs new file mode 100644 index 00000000..ba582930 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/BidirectionalMapKeyTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany +{ + using System.Threading.Tasks; + public partial class BidirectionalMapKeyTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(RefEdMapKeyEntity), ed_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(RefIngMapKeyEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(RefIngMapKeyEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEdAsync() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed_id, 2)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new Dictionary { { "a", ing1 } }, rev1.IdMap); + CollectionAssert.AreEquivalent(new Dictionary { { "a", ing1 }, { "b", ing2 } }, rev2.IdMap); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedListTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedListTest.cs new file mode 100644 index 00000000..889734ea --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedListTest.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class BasicDetachedListTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ListRefCollEntity), coll1_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str2_id)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryOfColl1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + var str2 = await (Session.GetAsync(str2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(coll1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(coll1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(coll1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(coll1_id, 4)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { str1 }, rev1.Collection); + CollectionAssert.AreEquivalent(new[] { str1, str2 }, rev2.Collection); + CollectionAssert.AreEquivalent(new[] { str2 }, rev3.Collection); + CollectionAssert.IsEmpty(rev4.Collection); + + Assert.AreEqual("coll1", rev1.Data); + Assert.AreEqual("coll1", rev2.Data); + Assert.AreEqual("coll1", rev3.Data); + Assert.AreEqual("coll1", rev4.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedSetTest.cs new file mode 100644 index 00000000..47221e1a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedSetTest.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class BasicDetachedSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefCollEntity), coll1_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str2_id)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryOfColl1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + var str2 = await (Session.GetAsync(str2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(coll1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(coll1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(coll1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(coll1_id, 4)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { str1 }, rev1.Collection); + CollectionAssert.AreEquivalent(new[] { str1, str2 }, rev2.Collection); + CollectionAssert.AreEquivalent(new[] { str2 }, rev3.Collection); + CollectionAssert.IsEmpty(rev4.Collection); + + Assert.AreEqual("coll1", rev1.Data); + Assert.AreEqual("coll1", rev2.Data); + Assert.AreEqual("coll1", rev3.Data); + Assert.AreEqual("coll1", rev4.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedSetWithEmbIdTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedSetWithEmbIdTest.cs new file mode 100644 index 00000000..f91c5cdf --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/BasicDetachedSetWithEmbIdTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Ids; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached.Ids; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class BasicDetachedSetWithEmbIdTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefCollEntityEmbId), coll1_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(EmbIdTestEntity), str1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(EmbIdTestEntity), str2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfColl1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + var str2 = await (Session.GetAsync(str2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(coll1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(coll1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(coll1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(coll1_id, 4)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { str1 }, rev1.Collection); + CollectionAssert.AreEquivalent(new[] { str1, str2 }, rev2.Collection); + CollectionAssert.AreEquivalent(new[] { str2 }, rev3.Collection); + CollectionAssert.IsEmpty(rev4.Collection); + + Assert.AreEqual("coll1", rev1.Data); + Assert.AreEqual("coll1", rev2.Data); + Assert.AreEqual("coll1", rev3.Data); + Assert.AreEqual("coll1", rev4.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DataChangesDetachedSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DataChangesDetachedSetTest.cs new file mode 100644 index 00000000..214d5d0d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DataChangesDetachedSetTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class DataChangesDetachedSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefCollEntity), coll1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str1_id)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryOfColl1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(coll1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(coll1_id, 2)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Collection); + CollectionAssert.AreEquivalent(new[] { str1 }, rev2.Collection); + + Assert.AreEqual("coll1", rev1.Data); + Assert.AreEqual("coll2", rev2.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DetachedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DetachedTest.cs new file mode 100644 index 00000000..c82118ba --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DetachedTest.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class DetachedTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (ListRefCollEntity), parentId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof (StrTestEntity), childId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1); + } + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + var parent = new ListRefCollEntity + { + Id = parentId, + Data = "initial data", + Collection = new List {new StrTestEntity {Id = childId, Str = "data"}} + }; + + var ver1 = await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false); + ver1.Should().Be.EqualTo(parent); + ver1.Collection.Should().Have.SameValuesAs(parent.Collection); + + parent.Data = "modified data"; + var ver2 = await (AuditReader().FindAsync(parentId, 2)).ConfigureAwait(false); + ver2.Should().Be.EqualTo(parent); + ver1.Collection.Should().Have.SameValuesAs(parent.Collection); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DoubleDetachedSetTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DoubleDetachedSetTest.cs new file mode 100644 index 00000000..af110e79 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DoubleDetachedSetTest.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class DoubleDetachedSetTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(DoubleSetRefCollEntity), coll1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), str2_id)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryOfColl1Async() + { + var str1 = await (Session.GetAsync(str1_id)).ConfigureAwait(false); + var str2 = await (Session.GetAsync(str2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(coll1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(coll1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(coll1_id, 3)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { str1 }, rev1.Collection); + CollectionAssert.AreEquivalent(new[] { str1, str2 }, rev2.Collection); + CollectionAssert.AreEquivalent(new[] { str2 }, rev3.Collection); + + CollectionAssert.AreEquivalent(new[] { str2 }, rev1.Collection2); + CollectionAssert.AreEquivalent(new[] { str2 }, rev2.Collection2); + CollectionAssert.AreEquivalent(new[] { str1, str2 }, rev3.Collection2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DoubleJoinColumnBidirectionalListTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DoubleJoinColumnBidirectionalListTest.cs new file mode 100644 index 00000000..33e5291c --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/DoubleJoinColumnBidirectionalListTest.cs @@ -0,0 +1,175 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class DoubleJoinColumnBidirectionalListTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(DoubleListJoinColumnBidirectionalRefIngEntity), ing2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity1), ed1_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity1), ed1_2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 4 }, await (AuditReader().GetRevisionsAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity2), ed2_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(DoubleListJoinColumnBidirectionalRefEdEntity2), ed2_2_id)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1_1_fromRev1 = new DoubleListJoinColumnBidirectionalRefEdEntity1 {Id = ed1_1_id, Data = "ed1_1"}; + var ed1_1_fromRev3 = new DoubleListJoinColumnBidirectionalRefEdEntity1{Id = ed1_1_id, Data = "ed1_1 bis"}; + var ed1_2 = await (Session.GetAsync(ed1_2_id)).ConfigureAwait(false); + var ed2_1 = await (Session.GetAsync(ed2_1_id)).ConfigureAwait(false); + var ed2_2_fromRev1 = new DoubleListJoinColumnBidirectionalRefEdEntity2 {Id = ed2_2_id, Data = "ed2_2"}; + var ed2_2_fromRev3 = new DoubleListJoinColumnBidirectionalRefEdEntity2{Id = ed2_2_id, Data = "ed2_2 bis"}; + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { ed1_1_fromRev1 }, rev1.References1); + CollectionAssert.AreEquivalent(new[] { ed1_1_fromRev1, ed1_2 }, rev2.References1); + CollectionAssert.AreEquivalent(new[] { ed1_1_fromRev3, ed1_2 }, rev3.References1); + CollectionAssert.IsEmpty(rev4.References1); + + CollectionAssert.AreEquivalent(new[] { ed2_1 }, rev1.References2); + CollectionAssert.AreEquivalent(new[] { ed2_1, ed2_2_fromRev1 }, rev2.References2); + CollectionAssert.AreEquivalent(new[] { ed2_1, ed2_2_fromRev3 }, rev3.References2); + CollectionAssert.AreEquivalent(new[] { ed2_2_fromRev3 }, rev4.References2); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed1_1_fromRev3 = new DoubleListJoinColumnBidirectionalRefEdEntity1 { Id = ed1_1_id, Data = "ed1_1 bis" }; + var ed1_2 = await (Session.GetAsync(ed1_2_id)).ConfigureAwait(false); + var ed2_1 = await (Session.GetAsync(ed2_1_id)).ConfigureAwait(false); + var ed2_2_fromRev1 = new DoubleListJoinColumnBidirectionalRefEdEntity2 { Id = ed2_2_id, Data = "ed2_2" }; + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + + CollectionAssert.AreEquivalent(new[] { ed1_2 }, rev1.References1); + CollectionAssert.IsEmpty(rev2.References1); + CollectionAssert.IsEmpty(rev3.References1); + CollectionAssert.AreEquivalent(new[] { ed1_1_fromRev3, ed1_2 }, rev4.References1); + + CollectionAssert.AreEquivalent(new[] { ed2_2_fromRev1 }, rev1.References2); + CollectionAssert.IsEmpty(rev2.References2); + CollectionAssert.IsEmpty(rev3.References2); + CollectionAssert.AreEquivalent(new[] { ed2_1 }, rev4.References2); + } + + [Test] + public async Task VerifyHistoryOfEd1_1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + + var rev1 = await (AuditReader().FindAsync(ed1_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_1_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + Assert.AreEqual(ing1, rev3.Owner); + Assert.AreEqual(ing2, rev4.Owner); + + Assert.AreEqual("ed1_1", rev1.Data); + Assert.AreEqual("ed1_1", rev2.Data); + Assert.AreEqual("ed1_1 bis", rev3.Data); + Assert.AreEqual("ed1_1 bis", rev4.Data); + } + + [Test] + public async Task VerifyHistoryOfEd1_2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + + var rev1 = await (AuditReader().FindAsync(ed1_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_2_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing2, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + Assert.AreEqual(ing1, rev3.Owner); + Assert.AreEqual(ing2, rev4.Owner); + + Assert.AreEqual("ed1_2", rev1.Data); + Assert.AreEqual("ed1_2", rev2.Data); + Assert.AreEqual("ed1_2", rev3.Data); + Assert.AreEqual("ed1_2", rev4.Data); + } + + [Test] + public async Task VerifyHistoryOfEd2_1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + + var rev1 = await (AuditReader().FindAsync(ed2_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_1_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + Assert.AreEqual(ing1, rev3.Owner); + Assert.AreEqual(ing2, rev4.Owner); + + Assert.AreEqual("ed2_1", rev1.Data); + Assert.AreEqual("ed2_1", rev2.Data); + Assert.AreEqual("ed2_1", rev3.Data); + Assert.AreEqual("ed2_1", rev4.Data); + } + + [Test] + public async Task VerifyHistoryOfEd2_2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + + var rev1 = await (AuditReader().FindAsync(ed2_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_2_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing2, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + Assert.AreEqual(ing1, rev3.Owner); + Assert.AreEqual(ing1, rev4.Owner); + + Assert.AreEqual("ed2_2", rev1.Data); + Assert.AreEqual("ed2_2", rev2.Data); + Assert.AreEqual("ed2_2 bis", rev3.Data); + Assert.AreEqual("ed2_2 bis", rev4.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/IndexedJoinColumnBidirectionalListTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/IndexedJoinColumnBidirectionalListTest.cs new file mode 100644 index 00000000..d0618f45 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/IndexedJoinColumnBidirectionalListTest.cs @@ -0,0 +1,129 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class IndexedJoinColumnBidirectionalListTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(IndexedListJoinColumnBidirectionalRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(IndexedListJoinColumnBidirectionalRefIngEntity), ing2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(IndexedListJoinColumnBidirectionalRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 4 }, await (AuditReader().GetRevisionsAsync(typeof(IndexedListJoinColumnBidirectionalRefEdEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(IndexedListJoinColumnBidirectionalRefEdEntity), ed3_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + var ed3 = await (Session.GetAsync(ed3_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + + CollectionAssert.AreEqual(new[] { ed1, ed2, ed3 }, rev1.References); + CollectionAssert.AreEqual(new[] { ed1, ed3 }, rev2.References); + CollectionAssert.AreEqual(new[] { ed3, ed1 }, rev3.References); + CollectionAssert.AreEqual(new[] { ed2, ed3, ed1 }, rev4.References); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.References); + CollectionAssert.AreEqual(new[] { ed2 }, rev2.References); + CollectionAssert.AreEqual(new[] { ed2 }, rev3.References); + CollectionAssert.IsEmpty(rev4.References); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + Assert.AreEqual(ing1, rev3.Owner); + Assert.AreEqual(ing1, rev4.Owner); + + Assert.AreEqual(0, rev1.Position); + Assert.AreEqual(0, rev2.Position); + Assert.AreEqual(1, rev3.Position); + Assert.AreEqual(2, rev4.Position); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Owner); + Assert.AreEqual(ing2, rev2.Owner); + Assert.AreEqual(ing2, rev3.Owner); + Assert.AreEqual(ing1, rev4.Owner); + + Assert.AreEqual(1, rev1.Position); + Assert.AreEqual(0, rev2.Position); + Assert.AreEqual(0, rev3.Position); + Assert.AreEqual(0, rev4.Position); + } + + [Test] + public async Task VerifyHistoryOfEd3Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed3_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed3_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed3_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed3_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + Assert.AreEqual(ing1, rev3.Owner); + Assert.AreEqual(ing1, rev4.Owner); + + Assert.AreEqual(2, rev1.Position); + Assert.AreEqual(1, rev2.Position); + Assert.AreEqual(0, rev3.Position); + Assert.AreEqual(1, rev4.Position); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/JoinColumnBidirectionalListTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/JoinColumnBidirectionalListTest.cs new file mode 100644 index 00000000..3d7eaa32 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/JoinColumnBidirectionalListTest.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class JoinColumnBidirectionalListTest :TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(ListJoinColumnBidirectionalRefIngEntity), ing1_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 4); + (await (AuditReader().GetRevisionsAsync(typeof(ListJoinColumnBidirectionalRefIngEntity), ing2_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 4); + (await (AuditReader().GetRevisionsAsync(typeof(ListJoinColumnBidirectionalRefEdEntity), ed1_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 3, 4); + (await (AuditReader().GetRevisionsAsync(typeof(ListJoinColumnBidirectionalRefEdEntity), ed2_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 4); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1_fromRev1 = new ListJoinColumnBidirectionalRefEdEntity {Id = ed1_id, Data = "ed1"}; + var ed1_fromRev3 = new ListJoinColumnBidirectionalRefEdEntity { Id = ed1_id, Data = "ed1 bis" }; + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing1_id, 4)).ConfigureAwait(false); + + rev1.References.Should().Have.SameValuesAs(ed1_fromRev1); + rev2.References.Should().Have.SameValuesAs(ed1_fromRev1, ed2); + rev3.References.Should().Have.SameValuesAs(ed1_fromRev3, ed2); + rev4.References.Should().Be.Empty(); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ing2_id, 4)).ConfigureAwait(false); + + rev1.References.Should().Have.SameValuesAs(ed2); + rev2.References.Should().Be.Empty(); + rev3.References.Should().Be.Empty(); + rev4.References.Should().Have.SameValuesAs(ed1, ed2); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + Assert.AreEqual(ing1, rev3.Owner); + Assert.AreEqual(ing2, rev4.Owner); + + Assert.AreEqual("ed1", rev1.Data); + Assert.AreEqual("ed1", rev2.Data); + Assert.AreEqual("ed1 bis", rev3.Data); + Assert.AreEqual("ed1 bis", rev4.Data); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_id, 4)).ConfigureAwait(false); + + Assert.AreEqual(ing2, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + Assert.AreEqual(ing1, rev3.Owner); + Assert.AreEqual(ing2, rev4.Owner); + + Assert.AreEqual("ed2", rev1.Data); + Assert.AreEqual("ed2", rev2.Data); + Assert.AreEqual("ed2", rev3.Data); + Assert.AreEqual("ed2", rev4.Data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/JoinColumnBidirectionalListWithInheritanceTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/JoinColumnBidirectionalListWithInheritanceTest.cs new file mode 100644 index 00000000..286e2764 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/Detached/JoinColumnBidirectionalListWithInheritanceTest.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached +{ + using System.Threading.Tasks; + public partial class JoinColumnBidirectionalListWithInheritanceTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ListJoinColumnBidirectionalInheritanceRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ListJoinColumnBidirectionalInheritanceRefIngEntity), ing2_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(ListJoinColumnBidirectionalInheritanceRefEdParentEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ListJoinColumnBidirectionalInheritanceRefEdParentEntity), ed2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + + CollectionAssert.AreEqual(new[] { ed1 }, rev1.References); + CollectionAssert.AreEqual(new[] { ed1, ed2 }, rev2.References); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + + CollectionAssert.AreEqual(new[] { ed2 }, rev1.References); + CollectionAssert.IsEmpty(rev2.References); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(ing2, rev1.Owner); + Assert.AreEqual(ing1, rev2.Owner); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/EmbeddedId/MapsIdTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/EmbeddedId/MapsIdTest.cs new file mode 100644 index 00000000..75d8e216 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/EmbeddedId/MapsIdTest.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.EmbeddedId +{ + using System.Threading.Tasks; + public partial class MapsIdTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (PersonTuple), tuple1Ver1.PersonTupleId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof (PersonTuple), tuple2Ver1.PersonTupleId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(2, 3); + (await (AuditReader().GetRevisionsAsync(typeof (Person), personCVer1.Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(2, 4); + } + + [Test] + public async Task VerifyHistoryOfTuple1Async() + { + var tuple = await (AuditReader().FindAsync(tuple1Ver1.PersonTupleId, 1)).ConfigureAwait(false); + tuple.Should().Be.EqualTo(tuple1Ver1); + tuple.HelloWorld.Should().Be.EqualTo(tuple1Ver1.HelloWorld); + tuple.PersonA.Id.Should().Be.EqualTo(tuple1Ver1.PersonA.Id); + tuple.PersonB.Id.Should().Be.EqualTo(tuple1Ver1.PersonB.Id); + } + + [Test] + public async Task VerifyHistoryOfTuple2Async() + { + var tuple = await (AuditReader().FindAsync(tuple2Ver2.PersonTupleId, 2)).ConfigureAwait(false); + tuple.Should().Be.EqualTo(tuple2Ver1); + tuple.HelloWorld.Should().Be.EqualTo(tuple2Ver1.HelloWorld); + tuple.PersonA.Id.Should().Be.EqualTo(tuple2Ver1.PersonA.Id); + tuple.PersonB.Id.Should().Be.EqualTo(tuple2Ver1.PersonB.Id); + + tuple = await (AuditReader().FindAsync(tuple2Ver2.PersonTupleId, 3)).ConfigureAwait(false); + tuple.Should().Be.EqualTo(tuple2Ver2); + tuple.HelloWorld.Should().Be.EqualTo(tuple2Ver2.HelloWorld); + tuple.PersonA.Id.Should().Be.EqualTo(tuple2Ver2.PersonA.Id); + tuple.PersonB.Id.Should().Be.EqualTo(tuple2Ver2.PersonB.Id); + } + + [Test] + public async Task VerifyHistoryOfPersonCAsync() + { + var person = await (AuditReader().FindAsync(personCVer1.Id, 2)).ConfigureAwait(false); + person.Should().Be.EqualTo(personCVer1); + person.PersonATuples.Should().Have.SameValuesAs(personCVer1.PersonATuples); + person.PersonBTuples.Should().Have.SameValuesAs(personCVer1.PersonBTuples); + + person = await (AuditReader().FindAsync(personCVer2.Id, 4)).ConfigureAwait(false); + person.Should().Be.EqualTo(personCVer2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/InverseSideChangesTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/InverseSideChangesTest.cs new file mode 100644 index 00000000..6f2cc895 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/InverseSideChangesTest.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToMany +{ + using System.Threading.Tasks; + public partial class InverseSideChangesTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2 }, await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), ing1_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Reffering); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + + Assert.IsNull(rev2.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/InverseToSuperclass/OneToManyInverseToSuperclassTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/InverseToSuperclass/OneToManyInverseToSuperclassTest.cs new file mode 100644 index 00000000..461be363 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToMany/InverseToSuperclass/OneToManyInverseToSuperclassTest.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.OneToMany.InverseToSuperclass +{ + using System.Threading.Tasks; + public partial class OneToManyInverseToSuperclassTest : TestBase + { + + [Test] + public async Task HistoryShouldExistAsync() + { + var rev1 = await (AuditReader().FindAsync(masterId, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(masterId, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(masterId, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(masterId, 4)).ConfigureAwait(false); + + rev1.Should().Not.Be.Null(); + rev2.Should().Not.Be.Null(); + rev3.Should().Not.Be.Null(); + rev4.Should().Not.Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/Bidirectional2Test.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/Bidirectional2Test.cs new file mode 100644 index 00000000..4a53d96b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/Bidirectional2Test.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional +{ + using System.Threading.Tasks; + public partial class Bidirectional2Test : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 4 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefEdEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefIngEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed1_id, 4)).ConfigureAwait(false); + + Assert.IsNull(rev1.Referencing); + Assert.AreEqual(ing1, rev2.Referencing); + Assert.AreEqual(ing2, rev3.Referencing); + Assert.IsNull(rev4.Referencing); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ed2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(ed2_id, 4)).ConfigureAwait(false); + + Assert.IsNull(rev1.Referencing); + Assert.IsNull(rev2.Referencing); + Assert.IsNull(rev3.Referencing); + Assert.AreEqual(ing1, rev4.Referencing); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalEagerHbmTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalEagerHbmTest.cs new file mode 100644 index 00000000..457f1320 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalEagerHbmTest.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToOne; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional +{ + using System.Threading.Tasks; + public partial class BidirectionalEagerHbmTest : TestBase + { + + [Test] + public async Task VerifyNonProxyObjectTraversingAsync() + { + var referencing = await (AuditReader().FindAsync(refIngId1, 1)).ConfigureAwait(false); + referencing.Reference.Data.Should().Not.Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalNoNullsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalNoNullsTest.cs new file mode 100644 index 00000000..cd5d511e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalNoNullsTest.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional +{ + using System.Threading.Tasks; + public partial class BidirectionalNoNullsTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefEdEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefIngEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Referencing); + Assert.AreEqual(ing2, rev2.Referencing); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var ing2 = await (Session.GetAsync(ing2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(ing2, rev1.Referencing); + Assert.AreEqual(ing1, rev2.Referencing); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalSaveTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalSaveTest.cs new file mode 100644 index 00000000..55bb9193 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalSaveTest.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional +{ + using System.Threading.Tasks; + public partial class BidirectionalSaveTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(BiRefEdEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + } + + [Test] + public async Task VerifyHistoryAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Data.Should().Be.EqualTo("2"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalTest.cs new file mode 100644 index 00000000..a41cd0ab --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/BidirectionalTest.cs @@ -0,0 +1,64 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional +{ + using System.Threading.Tasks; + public partial class BidirectionalTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefEdEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiRefIngEntity), ing1_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Referencing); + Assert.IsNull(rev2.Referencing); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + + Assert.IsNull(rev1.Referencing); + Assert.AreEqual(ing1, rev2.Referencing); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed2, rev2.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/Ids/EmbIdBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/Ids/EmbIdBidirectionalTest.cs new file mode 100644 index 00000000..f654eec9 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/Ids/EmbIdBidirectionalTest.cs @@ -0,0 +1,65 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Entities.Ids; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional.Ids +{ + using System.Threading.Tasks; + public partial class EmbIdBidirectionalTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiEmbIdRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiEmbIdRefEdEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(BiEmbIdRefIngEntity), ing1_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfEd1Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed1_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(ing1, rev1.Referencing); + Assert.IsNull(rev2.Referencing); + } + + [Test] + public async Task VerifyHistoryOfEd2Async() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ed2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ed2_id, 2)).ConfigureAwait(false); + + Assert.IsNull(rev1.Referencing); + Assert.AreEqual(ing1, rev2.Referencing); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed2, rev2.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/PrimaryKeyJoinColumn/OneToOneWithPrimaryKeyJoinTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/PrimaryKeyJoinColumn/OneToOneWithPrimaryKeyJoinTest.cs new file mode 100644 index 00000000..acfadf95 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/BiDirectional/PrimaryKeyJoinColumn/OneToOneWithPrimaryKeyJoinTest.cs @@ -0,0 +1,96 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Query; +using NHibernate.Proxy; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional.PrimaryKeyJoinColumn +{ + using System.Threading.Tasks; + public partial class OneToOneWithPrimaryKeyJoinTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Person), personId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof(Account), accountId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof(AccountNotAuditedOwners), accountNotAuditedOwnersId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(2); + } + + [Test] + public async Task VerifyHistoryOfPersonAsync() + { + var personVer1 = new Person {PersonId = personId, Name = "Robert"}; + var accountVer1 = new Account {AccountId = accountId, Type = "Saving"}; + personVer1.Account = accountVer1; + accountVer1.Owner = personVer1; + + var result = (object[])(await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (Person), false, true) + .Add(AuditEntity.Id().Eq(personId)) + .GetResultListAsync()).ConfigureAwait(false))[0]; + result[0].Should().Be.EqualTo(personVer1); + ((Person) result[0]).Account.Should().Be.EqualTo(accountVer1); + result[2].Should().Be.EqualTo(RevisionType.Added); + (await (AuditReader().FindAsync(personId, 1)).ConfigureAwait(false)).Should().Be.EqualTo(personVer1); + } + + [Test] + public async Task VerifyHistoryOfAccountAsync() + { + var personVer1 = new Person { PersonId = personId, Name = "Robert" }; + var accountVer1 = new Account { AccountId = accountId, Type = "Saving" }; + personVer1.Account = accountVer1; + accountVer1.Owner = personVer1; + + var result = (object[])(await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof(Account), false, true) + .Add(AuditEntity.Id().Eq(accountId)) + .GetResultListAsync()).ConfigureAwait(false))[0]; + result[0].Should().Be.EqualTo(accountVer1); + ((Account)result[0]).Owner.Should().Be.EqualTo(accountVer1.Owner); + result[2].Should().Be.EqualTo(RevisionType.Added); + (await (AuditReader().FindAsync(accountId, 1)).ConfigureAwait(false)).Should().Be.EqualTo(accountVer1); + } + + [Test] + public async Task VerifyHistoryOfAccountNotAuditedOwnersAsync() + { + var noProxyPersonVer1 = new NotAuditedNoProxyPerson {PersonId = noProxyPersonId, Name = "Kinga"}; + var proxyPersonVer1 = new NotAuditedProxyPerson {PersonId = proxyPersonId, Name = "Lukasz"}; + var accountNotAuditedOwnersVer1 = new AccountNotAuditedOwners {AccountId = accountNotAuditedOwnersId, Type = "Standard"}; + noProxyPersonVer1.Account = accountNotAuditedOwnersVer1; + proxyPersonVer1.Account = accountNotAuditedOwnersVer1; + accountNotAuditedOwnersVer1.Owner = noProxyPersonVer1; + accountNotAuditedOwnersVer1.CoOwner = proxyPersonVer1; + + var result = (object[]) (await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (AccountNotAuditedOwners), false, true) + .Add(AuditEntity.Id().Eq(accountNotAuditedOwnersId)) + .GetResultListAsync()).ConfigureAwait(false))[0]; + + var theResult = (AccountNotAuditedOwners) result[0]; + + result[0].Should().Be.EqualTo(accountNotAuditedOwnersVer1); + result[2].Should().Be.EqualTo(RevisionType.Added); + // Checking non-proxy reference + theResult.Owner.Should().Be.EqualTo(accountNotAuditedOwnersVer1.Owner); + // checking proxy reference + (theResult.CoOwner is INHibernateProxy).Should().Be.True(); + theResult.CoOwner.PersonId.Should().Be.EqualTo(proxyPersonVer1.PersonId); + + (await (AuditReader().FindAsync(typeof (AccountNotAuditedOwners), accountNotAuditedOwnersId, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(accountNotAuditedOwnersVer1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UniDirectionalWithNullsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UniDirectionalWithNullsTest.cs new file mode 100644 index 00000000..58be4093 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UniDirectionalWithNullsTest.cs @@ -0,0 +1,59 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.UniDirectional +{ + using System.Threading.Tasks; + public partial class UniDirectionalWithNullsTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefEdEntity), ed2_id)).ConfigureAwait(false)); + + + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefIngEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed1, rev2.Reference); + Assert.IsNull(rev3.Reference); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + + Assert.IsNull(rev1.Reference); + Assert.AreEqual(ed2, rev2.Reference); + Assert.AreEqual(ed2, rev3.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UnidirectionalMulIdWithNullsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UnidirectionalMulIdWithNullsTest.cs new file mode 100644 index 00000000..422ca3f2 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UnidirectionalMulIdWithNullsTest.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.Ids; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.UniDirectional +{ + using System.Threading.Tasks; + public partial class UnidirectionalMulIdWithNullsTest : TestBase + { + + [Test] + public async Task VerifyNullReferenceAsync() + { + (await (AuditReader().FindAsync(2, 1)).ConfigureAwait(false)).Reference + .Should().Be.Null(); + } + + [Test] + public async Task VerifyNotNullReferenceAsync() + { + (await (AuditReader().FindAsync(1, 1)).ConfigureAwait(false)).Reference.Str1 + .Should().Be.EqualTo("data"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UnidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UnidirectionalTest.cs new file mode 100644 index 00000000..b5f21aef --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/OneToOne/UniDirectional/UnidirectionalTest.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.OneToOne.UniDirectional +{ + using System.Threading.Tasks; + public partial class UnidirectionalTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefEdEntity), ed1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefEdEntity), ed2_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefEdEntity), ed3_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefEdEntity), ed4_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefIngEntity), ing1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 3 }, await (AuditReader().GetRevisionsAsync(typeof(UniRefIngEntity), ing2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIng1Async() + { + var ed1 = await (Session.GetAsync(ed1_id)).ConfigureAwait(false); + var ed2 = await (Session.GetAsync(ed2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing1_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(ed1, rev1.Reference); + Assert.AreEqual(ed2, rev2.Reference); + Assert.AreEqual(ed2, rev3.Reference); + } + + [Test] + public async Task VerifyHistoryOfIng2Async() + { + var ed3 = await (Session.GetAsync(ed3_id)).ConfigureAwait(false); + var ed4 = await (Session.GetAsync(ed4_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(ing2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ing2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(ing2_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(ed3, rev1.Reference); + Assert.AreEqual(ed3, rev2.Reference); + Assert.AreEqual(ed4, rev3.Reference); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Primitive/PrimitiveAddDeleteTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Primitive/PrimitiveAddDeleteTest.cs new file mode 100644 index 00000000..38589e07 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Primitive/PrimitiveAddDeleteTest.cs @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Primitive +{ + using System.Threading.Tasks; + public partial class PrimitiveAddDeleteTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(PrimitiveTestEntity), id1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfId1Async() + { + var ver1 = new PrimitiveTestEntity { Id = id1, Number = 10, Number2 = 0 }; + var ver2 = new PrimitiveTestEntity { Id = id1, Number = 20, Number2 = 0 }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id1, 2)).ConfigureAwait(false)); + Assert.IsNull(await (AuditReader().FindAsync(id1, 3)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyQueryWithDeletedAsync() + { + var entities = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(PrimitiveTestEntity), true, true).GetResultListAsync()).ConfigureAwait(false); + + var expected = new[] + { + new PrimitiveTestEntity {Id = id1, Number = 10, Number2 = 0}, + new PrimitiveTestEntity {Id = id1, Number = 20, Number2 = 0}, + new PrimitiveTestEntity {Id = id1, Number = 0, Number2 = 0} + }; + CollectionAssert.AreEqual(expected, entities); + } + + [Test] + public async Task VerifyQueryWithDeletedUsingGenericAsync() + { + var entities = await (AuditReader().CreateQuery().ForRevisionsOf(true).ResultsAsync()).ConfigureAwait(false); + + var expected = new[] + { + new PrimitiveTestEntity {Id = id1, Number = 10, Number2 = 0}, + new PrimitiveTestEntity {Id = id1, Number = 20, Number2 = 0}, + new PrimitiveTestEntity {Id = id1, Number = 0, Number2 = 0} + }; + entities.Should().Have.SameSequenceAs(expected); + } + + [Test] + public async Task VerifyQueryWithNoDeletedUsingGenericAsync() + { + var entities = await (AuditReader().CreateQuery() + .ForRevisionsOf().ResultsAsync()).ConfigureAwait(false); + + var expected = new[] + { + new PrimitiveTestEntity {Id = id1, Number = 10, Number2 = 0}, + new PrimitiveTestEntity {Id = id1, Number = 20, Number2 = 0} + }; + entities.Should().Have.SameSequenceAs(expected); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Properties/UnversionedOptimisticLockingFieldTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Properties/UnversionedOptimisticLockingFieldTest.cs new file mode 100644 index 00000000..5c910ca7 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Properties/UnversionedOptimisticLockingFieldTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Properties +{ + using System.Threading.Tasks; + public partial class UnversionedOptimisticLockingFieldTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (UnversionedOptimisticLockingFieldEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new UnversionedOptimisticLockingFieldEntity {Id = id, Str = "x"}; + var ver2 = new UnversionedOptimisticLockingFieldEntity {Id = id, Str = "y"}; + + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Properties/VersionsPropertiesTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Properties/VersionsPropertiesTest.cs new file mode 100644 index 00000000..75185046 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Properties/VersionsPropertiesTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Properties +{ + using System.Threading.Tasks; + public partial class VersionsPropertiesTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(PropertiesTestEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new PropertiesTestEntity { Id = id, Str = "x" }; + var ver2 = new PropertiesTestEntity { Id = id, Str = "y" }; + + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/AuditedCollectionProxyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/AuditedCollectionProxyTest.cs new file mode 100644 index 00000000..b98fce65 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/AuditedCollectionProxyTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Tests.Entities.OneToMany; +using NHibernate.Proxy; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class AuditedCollectionProxyTest : TestBase + { + + [Test] + public async Task VerifyProxyIdentifierAsync() + { + var refEntity = await (Session.LoadAsync(1)).ConfigureAwait(false); + refEntity.Should().Be.InstanceOf(); + + var refingEntity3 = new SetRefIngEntity { Id = 3, Data = "refing2", Reference = refEntity }; + + //rev 3 + using (var tx = Session.BeginTransaction()) + { + await (Session.SaveAsync(refingEntity3)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/ProxyIdentifierTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/ProxyIdentifierTest.cs new file mode 100644 index 00000000..3160f551 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/ProxyIdentifierTest.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.ManyToMany.UniDirectional; +using NHibernate.Envers.Tests.Entities.ManyToOne.UniDirectional; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NHibernate.Proxy; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class ProxyIdentifierTest : TestBase + { + + [Test] + public async Task VerifyProxyIdentifierAsync() + { + var rev1 = await (AuditReader().FindAsync(tnae1.Id, 1)).ConfigureAwait(false); + var proxyCreatedByEnvers = rev1.Reference as INHibernateProxy; + + Assert.IsNotNull(proxyCreatedByEnvers); + + var lazyInitializer = proxyCreatedByEnvers.HibernateLazyInitializer; + Assert.IsTrue(lazyInitializer.IsUninitialized); + Assert.AreEqual(tnae1.Id, lazyInitializer.Identifier); + Assert.IsTrue(lazyInitializer.IsUninitialized); + + Assert.AreEqual(uste1.Id, rev1.Reference.Id); + Assert.AreEqual(uste1.Str, rev1.Reference.Str); + Assert.IsFalse(lazyInitializer.IsUninitialized); + } + + [Test] + public async Task VerifyNullReferenceWithNotFoundActionIgnoreAsync() + { + var mtoRev2 = await (AuditReader().FindAsync(mtonane1.Id, 2)).ConfigureAwait(false); + mtoRev2.Should().Be.EqualTo(mtonane1); + mtoRev2.Reference.Should().Be.Null(); + + var mtmRev2 = await (AuditReader().FindAsync(mtmnane1.Id, 2)).ConfigureAwait(false); + mtmRev2.Should().Be.EqualTo(mtmnane1); + mtmRev2.References.Should().Be.Empty(); + + var otmRev2 = await (AuditReader().FindAsync(otmnane1.Id, 2)).ConfigureAwait(false); + otmRev2.Should().Be.EqualTo(otmnane1); + otmRev2.References.Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/RemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/RemovedObjectQueryTest.cs new file mode 100644 index 00000000..b066a6fb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Proxy/RemovedObjectQueryTest.cs @@ -0,0 +1,241 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Collection; +using NHibernate.Envers.Tests.Entities.ManyToMany; +using NHibernate.Envers.Tests.Entities.ManyToMany.UniDirectional; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NHibernate.Envers.Tests.Integration.ManyToMany.Ternary; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class RemovedObjectQueryTest : TestBase + { + + [Test] + public async Task VerifyTernaryMapAsync() + { + var ternaryMap = new TernaryMapEntity { Id = ternaryMapId }; + ternaryMap.Map[intEntity1] = stringEntity1; + ternaryMap.Map[new IntTestPrivSeqEntity { Id = intEntity2.Id, Number = 2 }] = new StrTestPrivSeqEntity + { + Id = stringEntity2.Id, + Str = "value 2" + }; + + var entity = await (AuditReader().FindAsync(ternaryMapId, 15)).ConfigureAwait(false); + entity.Map.Should().Have.SameValuesAs(ternaryMap.Map); + + ternaryMap.Map.Clear(); + ternaryMap.Map.Add(intEntity1, stringEntity1); + ternaryMap.Map.Add(intEntity2, stringEntity2); + + entity = await (AuditReader().FindAsync(ternaryMapId, 16)).ConfigureAwait(false); + entity.Map.Should().Have.SameValuesAs(ternaryMap.Map); + + var res = (await (AuditReader().CreateQuery().ForHistoryOf(true) + .Add(AuditEntity.Id().Eq(ternaryMapId)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(17); + res.Entity.Map.Should().Have.SameValuesAs(ternaryMap.Map); + } + + [Test] + public async Task VerifyOneToManyCollectionSemanticsAsync() + { + var edVer1 = new CollectionRefEdEntity {Id = 1, Data = "data_ed_1"}; + var ingVer1 = new CollectionRefIngEntity {Id = 2, Data = "data_ing_1"}; + var ingVer2 = new CollectionRefIngEntity {Id = 2, Data = "modified data_ing_1"}; + + var entity = await (AuditReader().FindAsync(1, 18)).ConfigureAwait(false); + entity.Should().Be.EqualTo(edVer1); + entity.Reffering.Should().Have.SameValuesAs(ingVer1); + + entity = await (AuditReader().FindAsync(1, 19)).ConfigureAwait(false); + entity.Reffering.Should().Have.SameValuesAs(ingVer2); + + var res = (await (AuditReader().CreateQuery().ForHistoryOf(true) + .Add(AuditEntity.Id().Eq(1)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(20); + res.Entity.Data.Should().Be.EqualTo("data_ed_1"); + res.Entity.Reffering.Should().Have.SameValuesAs(ingVer2); + } + + [Test] + public async Task VerifyManyToManyCollectionSemanticsAsync() + { + var edVer1 = new ListOwnedEntity { Id = 1, Data = "data_ed_1" }; + var ingVer1 = new ListOwningEntity { Id = 2, Data = "data_ing_1" }; + var ingVer2 = new ListOwningEntity { Id = 2, Data = "modified data_ing_1" }; + + var entity = await (AuditReader().FindAsync(1, 21)).ConfigureAwait(false); + entity.Should().Be.EqualTo(edVer1); + entity.Referencing.Should().Have.SameValuesAs(ingVer1); + + entity = await (AuditReader().FindAsync(1, 22)).ConfigureAwait(false); + entity.Referencing.Should().Have.SameValuesAs(ingVer2); + + var res = (await (AuditReader().CreateQuery().ForHistoryOf(true) + .Add(AuditEntity.Id().Eq(1)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(23); + res.Entity.Data.Should().Be.EqualTo("data_ed_1"); + res.Entity.Referencing.Should().Have.SameValuesAs(ingVer2); + } + + [Test] + public async Task VerifyUnversionedRelationAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(1)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(14); + res.Entity.References + .Should().Have.SameSequenceAs(unversionedEntity1, unversionedEntity2); + } + + [Test] + public async Task VerifyElementCollectionAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(stringSetId)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(12); + res.Entity.Strings + .Should().Have.SameValuesAs("string 1", "string 2"); + } + + [Test] + public async Task VerifyReferencedOneToManySameRevisionAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(2)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(2); + res.Entity.Data.Should().Be.EqualTo("Example Data 1"); + res.Entity.Reference.Data.Should().Be.EqualTo("Demo Data 1"); + } + + [Test] + public async Task VerifyReferringOneToManySameRevisionAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(1)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(2); + res.Entity.Data.Should().Be.EqualTo("Demo Data 1"); + res.Entity.Reffering.Should().Have.SameValuesAs(new SetRefIngEntity { Id = 2, Data = "Example Data 1" }); + } + + [Test] + public async Task VerifyReferencedOneToManyDifferentRevisionsAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(4)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(4); + res.Entity.Data.Should().Be.EqualTo("Example Data 2"); + res.Entity.Reference.Data.Should().Be.EqualTo("Demo Data 2"); + } + + [Test] + public async Task VerifyReferringOneToManyDifferentRevisionAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(3)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(5); + res.Entity.Data.Should().Be.EqualTo("Demo Data 2"); + res.Entity.Reffering.Should().Be.Empty(); + + //after commit in revision 4, child entity has been removed + res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(3)) + .Add(AuditEntity.RevisionNumber().Eq(4)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.Entity.Data.Should().Be.EqualTo("Demo Data 2"); + res.Entity.Reffering.Should().Be.Empty(); + } + + [Test] + public async Task VerifyOwnedManyToManySameRevisionAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(5)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(7); + res.Entity.Data.Should().Be.EqualTo("Demo Data 1"); + res.Entity.References.Should().Have.SameValuesAs(new SetOwnedEntity { Id = 6, Data = "Example Data 1" }); + } + + [Test] + public async Task VerifyOwningManyToManySameRevisionAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(6)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(7); + res.Entity.Data.Should().Be.EqualTo("Example Data 1"); + res.Entity.Referencing.Should().Have.SameValuesAs(new SetOwningEntity { Id = 5, Data = "Demo Data 1" }); + } + + [Test] + public async Task VerifyOwnedManyToManyDifferentRevisionsAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(7)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(9); + res.Entity.Data.Should().Be.EqualTo("Demo Data 2"); + res.Entity.References.Should().Have.SameValuesAs(new SetOwnedEntity { Id = 8, Data = "Example Data 2" }); + } + + [Test] + public async Task VerifyOwningManyToManyDifferentRevisionsAsync() + { + var res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(8)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Deleted)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.Id.Should().Be.EqualTo(10); + res.Entity.Data.Should().Be.EqualTo("Example Data 2"); + res.Entity.Referencing.Should().Be.Empty(); + + //after commit in revision 9, related entity has been removed + res = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(8)) + .Add(AuditEntity.RevisionNumber().Eq(9)) + .ResultsAsync()).ConfigureAwait(false)).First(); + res.Entity.Data.Should().Be.EqualTo("Example Data 2"); + res.Entity.Referencing.Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/AggregateQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/AggregateQueryTest.cs new file mode 100644 index 00000000..344f4199 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/AggregateQueryTest.cs @@ -0,0 +1,120 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Ids; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class AggregateQueryTest : TestBase + { + + [Test] + public async Task VerifyEntitiesAvgMaxQueryAsync() + { + var ver1 = (object[])await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 1) + .AddProjection(AuditEntity.Property("Number").Max()) + .AddProjection(AuditEntity.Property("Number").Function("avg")) + .GetSingleResultAsync()).ConfigureAwait(false); + var ver2 = (object[])await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 2) + .AddProjection(AuditEntity.Property("Number").Max()) + .AddProjection(AuditEntity.Property("Number").Function("avg")) + .GetSingleResultAsync()).ConfigureAwait(false); + var ver3 = (object[])await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 3) + .AddProjection(AuditEntity.Property("Number").Max()) + .AddProjection(AuditEntity.Property("Number").Function("avg")) + .GetSingleResultAsync()).ConfigureAwait(false); + + Assert.AreEqual(10, ver1[0]); + Assert.AreEqual(6, ver1[1]); + + Assert.AreEqual(10, ver2[0]); + Assert.AreEqual(6, ver2[1]); + + Assert.AreEqual(52, ver3[0]); + Assert.AreEqual(20, ver3[1]); + } + + [Test] + public async Task VerifyEntityIdProjectionAsync() + { + var maxId = await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (IntTestEntity), true, true) + .AddProjection(AuditEntity.Id().Max()) + .Add(AuditEntity.RevisionNumber().Gt(2)) + .GetSingleResultAsync()).ConfigureAwait(false); + maxId.Should().Be.EqualTo(2); + } + + [Test] + public async Task VerifyEntityIdRestrictionAsync() + { + (await (AuditReader().CreateQuery().ForRevisionsOf(true) + .Add(AuditEntity.Id().Between(2, 3)) + .ResultsAsync()).ConfigureAwait(false)) + .Should().Have.SameValuesAs(new IntTestEntity {Id = 2, Number = 10}, + new IntTestEntity {Id = 3, Number = 8}, + new IntTestEntity {Id = 2, Number = 52}); + } + + [Test] + public async Task VerifyEntityIdOrderingAsync() + { + (await (AuditReader().CreateQuery().ForRevisionsOf(true) + .Add(AuditEntity.RevisionNumber().Lt(2)) + .AddOrder(AuditEntity.Id().Desc()) + .ResultsAsync()).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(new IntTestEntity {Id = 2, Number = 10}, new IntTestEntity {Id = 1, Number = 2}); + } + + [Test] + public async Task VerifyUnusualIdFieldNameAsync() + { + (await (AuditReader().CreateQuery().ForRevisionsOf(true) + .Add(AuditEntity.Id().Like("Id1")) + .SingleAsync()).ConfigureAwait(false)) + .Should().Be.EqualTo(new UnusualIdNamingEntity {UniqueField = "Id1", VariousData = "data1"}); + } + + [Test] + public async Task VerifyEntityIdModifiedFlagNotSupportedAsync() + { + try + { + await (AuditReader().CreateQuery().ForRevisionsOf(true) + .Add(AuditEntity.Id().HasChanged()) + .ResultsAsync()).ConfigureAwait(false); + } + catch (NotSupportedException) + { + try + { + await (AuditReader().CreateQuery().ForRevisionsOf(true) + .Add(AuditEntity.Id().HasNotChanged()) + .ResultsAsync()).ConfigureAwait(false); + } + catch (NotSupportedException) + { + return; + } + Assert.Fail(); + } + Assert.Fail(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/CustomRevEntityQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/CustomRevEntityQueryTest.cs new file mode 100644 index 00000000..f455313e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/CustomRevEntityQueryTest.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class CustomRevEntityQueryTest : TestBase + { + + [Test] + public async Task VerifyRevisionsOfId1QueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + + Assert.AreEqual(new StrIntTestEntity {Str = "a", Number = 10, Id = id1}, ((IList)result[0])[0]); + var customRevEntity1 = ((IList) result[0])[1]; + Assert.IsInstanceOf(customRevEntity1); + Assert.AreEqual(1, ((CustomRevEntity)customRevEntity1).CustomId); + + Assert.AreEqual(new StrIntTestEntity { Str = "c", Number = 10, Id = id1 }, ((IList)result[1])[0]); + var customRevEntity2 = ((IList)result[1])[1]; + Assert.IsInstanceOf(customRevEntity2); + Assert.AreEqual(2, ((CustomRevEntity)customRevEntity2).CustomId); + } + + [Test] + public async Task VerifyRevisionsOfId2QueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id2)) + .GetResultListAsync()).ConfigureAwait(false); + + Assert.AreEqual(new StrIntTestEntity { Str = "b", Number = 15, Id = id2 }, ((IList)result[0])[0]); + var customRevEntity1 = ((IList)result[0])[1]; + Assert.IsInstanceOf(customRevEntity1); + Assert.AreEqual(1, ((CustomRevEntity)customRevEntity1).CustomId); + } + + [Test] + public async Task VerifyRevisionPropertyRestrictionAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id1)) + .Add(AuditEntity.RevisionProperty("CustomTimestamp").Ge(timestamp)) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(new StrIntTestEntity { Str = "c", Number = 10, Id = id1 }, ((IList)result[0])[0]); + var customRevEntity1 = ((IList)result[0])[1]; + Assert.IsInstanceOf(customRevEntity1); + Assert.IsTrue(((CustomRevEntity)customRevEntity1).CustomTimestamp >= timestamp); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/DeletedEntitiesTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/DeletedEntitiesTest.cs new file mode 100644 index 00000000..83886d17 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/DeletedEntitiesTest.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class DeletedEntitiesTest : TestBase + { + + [Test] + public async Task VerifyProjectionsInEntitiesAtRevisionAsync() + { + Assert.AreEqual(2, (await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof (StrIntTestEntity), 1).GetResultListAsync()).ConfigureAwait(false)).Count); + Assert.AreEqual(1, (await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof (StrIntTestEntity), 2).GetResultListAsync()).ConfigureAwait(false)).Count); + + Assert.AreEqual(2, + (await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(StrIntTestEntity), 1).AddProjection(AuditEntity.Id().Count()).GetResultListAsync()).ConfigureAwait(false))[0]); + Assert.AreEqual(1, + (await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(StrIntTestEntity), 2).AddProjection(AuditEntity.Id().Count()).GetResultListAsync()).ConfigureAwait(false))[0]); + } + + [Test] + public async Task VerifyRevisionOfEntityWithoutDeleteAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), false, false) + .Add(AuditEntity.Id().Eq(id2)) + .GetResultListAsync()).ConfigureAwait(false); + + Assert.AreEqual(1, result.Count); + var res = (object[]) result[0]; + Assert.AreEqual(new StrIntTestEntity { Str = "b", Number = 11, Id=id2 }, res[0]); + Assert.AreEqual(1, ((DefaultRevisionEntity)res[1]).Id); + Assert.AreEqual(RevisionType.Added, res[2]); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/Ids/EmbIdOneToManyQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/Ids/EmbIdOneToManyQueryTest.cs new file mode 100644 index 00000000..e8d8e805 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/Ids/EmbIdOneToManyQueryTest.cs @@ -0,0 +1,136 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities.Ids; +using NHibernate.Envers.Tests.Entities.OneToMany.Ids; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Query.Ids +{ + using System.Threading.Tasks; + public partial class EmbIdOneToManyQueryTest : TestBase + { + + [Test] + public async Task VerifyEntitiesReferencedToId3Async() + { + var rev1_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof (SetRefIngEmbIdEntity), 1) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .GetResultListAsync()).ConfigureAwait(false); + var rev1 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 1) + .Add(AuditEntity.Property("Reference").Eq(new SetRefEdEmbIdEntity {Id = id3})) + .GetResultListAsync()).ConfigureAwait(false); + + var rev2_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 2) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .GetResultListAsync()).ConfigureAwait(false); + var rev2 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 2) + .Add(AuditEntity.Property("Reference").Eq(new SetRefEdEmbIdEntity { Id = id3 })) + .GetResultListAsync()).ConfigureAwait(false); + + var rev3_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 3) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .GetResultListAsync()).ConfigureAwait(false); + var rev3 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 3) + .Add(AuditEntity.Property("Reference").Eq(new SetRefEdEmbIdEntity { Id = id3 })) + .GetResultListAsync()).ConfigureAwait(false); + + Assert.AreEqual(rev1, rev1_related); + Assert.AreEqual(rev2, rev2_related); + Assert.AreEqual(rev3, rev3_related); + + CollectionAssert.IsEmpty(rev1); + CollectionAssert.AreEquivalent(new[] + { + new SetRefIngEmbIdEntity { Id = id1, Data = "x" } + }, rev2); + CollectionAssert.AreEquivalent(new[] + { + new SetRefIngEmbIdEntity { Id = id1, Data = "x" }, + new SetRefIngEmbIdEntity{ Id = id2, Data = "y" } + }, rev3); + } + + [Test] + public async Task VerifyEntitiesReferencedToId4Async() + { + var rev1_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 1) + .Add(AuditEntity.RelatedId("Reference").Eq(id4)) + .GetResultListAsync()).ConfigureAwait(false); + var rev2_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 2) + .Add(AuditEntity.RelatedId("Reference").Eq(id4)) + .GetResultListAsync()).ConfigureAwait(false); + var rev3_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 3) + .Add(AuditEntity.RelatedId("Reference").Eq(id4)) + .GetResultListAsync()).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1_related); + CollectionAssert.AreEquivalent(new[]{new SetRefIngEmbIdEntity{ Id = id2, Data = "y" }}, rev2_related); + CollectionAssert.IsEmpty(rev3_related); + } + + [Test] + public async Task VerifyEntitiesReferencedByIng1ToId3Async() + { + var rev1_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 1) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + var rev2_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof (SetRefIngEmbIdEntity), 2) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + var rev3_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof (SetRefIngEmbIdEntity), 3) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.IsEmpty(rev1_related); + CollectionAssert.AreEquivalent(new[] { new SetRefIngEmbIdEntity { Id = id1, Data = "x" } }, rev2_related); + CollectionAssert.AreEquivalent(new[] { new SetRefIngEmbIdEntity { Id = id1, Data = "x" } }, rev3_related); + } + + [Test] + public async Task VerifyEntitiesReferencedByIng2ToId3Async() + { + var rev1_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 1) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .Add(AuditEntity.Id().Eq(id2)) + .GetResultListAsync()).ConfigureAwait(false); + var rev2_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 2) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .Add(AuditEntity.Id().Eq(id2)) + .GetResultListAsync()).ConfigureAwait(false); + var rev3_related = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(SetRefIngEmbIdEntity), 3) + .Add(AuditEntity.RelatedId("Reference").Eq(id3)) + .Add(AuditEntity.Id().Eq(id2)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.IsEmpty(rev1_related); + CollectionAssert.IsEmpty(rev2_related); + CollectionAssert.AreEquivalent(new[] { new SetRefIngEmbIdEntity { Id = id2, Data = "y" } }, rev3_related); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/MaximalizePropertyQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/MaximalizePropertyQueryTest.cs new file mode 100644 index 00000000..65cac1ff --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/MaximalizePropertyQueryTest.cs @@ -0,0 +1,102 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class MaximalizePropertyQueryTest : TestBase + { + + [Test] + public async Task VerifyMaximzeWithIdEqAsync() + { + var revsId1 = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.Property("Number").Maximize() + .Add(AuditEntity.Id().Eq(id2))) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEqual(new[]{2, 3, 4}, revsId1); + } + + [Test] + public async Task VerifyMinimizeWithPropertyEqAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.Property("Number").Minimize() + .Add(AuditEntity.Property("Str").Eq("a"))) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEqual(new[] { 1 }, result); + } + + [Test] + public async Task VerifyMaximizeRevisionAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.RevisionNumber().Maximize() + .Add(AuditEntity.Property("Number").Eq(10))) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[]{2}, result); + } + + [Test] + public async Task VerifyMaximizeInDisjunctionAsync() + { + var idsToQuery = new[] {id1, id3}; + var disjuction = AuditEntity.Disjunction(); + foreach (var id in idsToQuery) + { + disjuction.Add(AuditEntity.RevisionNumber().Maximize().Add(AuditEntity.Id().Eq(id))); + } + var result = await (AuditReader().CreateQuery() + .ForRevisionsOf(true) + .Add(disjuction) + .ResultsAsync()).ConfigureAwait(false); + var idsSeen = new HashSet(); + foreach (var entity in result) + { + var id = entity.Id; + idsToQuery.Should().Contain(id); + idsSeen.Add(id).Should().Be.True(); + } + } + + [Test] + public async Task VerifyAllLatestRevisionOfEntityTypeAsync() + { + var result =await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .Add(AuditEntity.RevisionNumber().Maximize().ComputeAggregationInInstanceContext()) + .AddOrder(AuditEntity.Property("id" ).Asc()) + .GetResultListAsync()).ConfigureAwait(false); + + result.Count.Should().Be.EqualTo(4); + + var result1 = (object[])result[0]; + var result2 = (object[])result[1]; + var result3 = (object[])result[2]; + var result4 = (object[])result[3]; + checkRevisionData(result1, 4, RevisionType.Modified, new StrIntTestEntity{Id=id1, Number = 5, Str = "d"}); + checkRevisionData(result2, 4, RevisionType.Modified, new StrIntTestEntity{Id=id2, Number = 20, Str = "a"}); + checkRevisionData(result3, 1, RevisionType.Added, new StrIntTestEntity{Id=id3, Number = 42, Str = "c"}); + checkRevisionData(result4, 5, RevisionType.Deleted, new StrIntTestEntity{Id=id4, Number = 0, Str = null}); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/NullPropertyQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/NullPropertyQueryTest.cs new file mode 100644 index 00000000..d3937f24 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/NullPropertyQueryTest.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Ids; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NHibernate.Envers.Tests.Entities.OneToMany.Ids; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class NullPropertyQueryTest : TestBase + { + + [Test] + public async Task SimplePropertyIsNullQueryAsync() + { + var ver = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(1) + .Add(AuditEntity.Property("Str").IsNull()) + .SingleAsync()).ConfigureAwait(false); + ver.Should().Be.EqualTo(new StrIntTestEntity {Id = idSimplePropertyNull, Number = 1, Str = null}); + } + + [Test] + public async Task SimplePropertyIsNotNullQueryAsync() + { + var ver = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(1) + .Add(AuditEntity.Property("Str").IsNotNull()) + .SingleAsync()).ConfigureAwait(false); + ver.Should().Be.EqualTo(new StrIntTestEntity { Id = idSimplePropertyNotNull, Number = 2, Str = "data" }); + } + + [Test] + public async Task ReferenceMulticolumnPropertyIsNullQueryAsync() + { + var ver = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(2) + .Add(AuditEntity.Property("Reference").IsNull()) + .SingleAsync()).ConfigureAwait(false); + ver.Id.Should().Be.EqualTo(idMulticolumnReferenceToParentNull); + } + + [Test] + public async Task ReferencePropertyIsNotNullQueryAsync() + { + var ver = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(3) + .Add(AuditEntity.Property("Reference").IsNotNull()) + .SingleAsync()).ConfigureAwait(false); + ver.Id.Should().Be.EqualTo(idReferenceToParentNotNull); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/OrderByLimitQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/OrderByLimitQueryTest.cs new file mode 100644 index 00000000..76c46906 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/OrderByLimitQueryTest.cs @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class OrderByLimitQueryTest : TestBase + { + + [Test] + public async Task VerifyEntitiesOrderLimitByQueryRev1Async() + { + var res_0_to_1 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 1) + .AddOrder(AuditEntity.Property("Number").Desc()) + .SetFirstResult(0) + .SetMaxResults(2) + .GetResultListAsync()).ConfigureAwait(false); + var res_2_to_3 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 1) + .AddOrder(AuditEntity.Property("Number").Desc()) + .SetFirstResult(2) + .SetMaxResults(2) + .GetResultListAsync()).ConfigureAwait(false); + var res_empty = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 1) + .AddOrder(AuditEntity.Property("Number").Desc()) + .SetFirstResult(4) + .SetMaxResults(2) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEqual(new[] + { + new IntTestEntity {Id = id1, Number = 12}, new IntTestEntity {Id = id3, Number = 8} + }, res_0_to_1); + CollectionAssert.AreEqual(new[] + { + new IntTestEntity {Id = id2, Number = 5}, new IntTestEntity {Id = id4, Number = 1} + }, res_2_to_3); + CollectionAssert.IsEmpty(res_empty); + } + + [Test] + public async Task VerifyEntitiesOrderLimitByQueryRev2Async() + { + var res_0_to_1 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 2) + .AddOrder(AuditEntity.Property("Number").Desc()) + .SetFirstResult(0) + .SetMaxResults(2) + .GetResultListAsync()).ConfigureAwait(false); + var res_2_to_3 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 2) + .AddOrder(AuditEntity.Property("Number").Desc()) + .SetFirstResult(2) + .SetMaxResults(2) + .GetResultListAsync()).ConfigureAwait(false); + var res_4 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(IntTestEntity), 2) + .AddOrder(AuditEntity.Property("Number").Desc()) + .SetFirstResult(4) + .SetMaxResults(2) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEqual(new[] + { + new IntTestEntity {Id = id4, Number = 15}, new IntTestEntity {Id = id3, Number = 8} + }, res_0_to_1); + CollectionAssert.AreEqual(new[] + { + new IntTestEntity {Id = id2, Number = 5}, new IntTestEntity {Id = id5, Number = 3} + }, res_2_to_3); + CollectionAssert.AreEqual(new[] + { + new IntTestEntity {Id = id1, Number = 0} + }, res_4); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/RevisionConstraintQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/RevisionConstraintQueryTest.cs new file mode 100644 index 00000000..519d8211 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/RevisionConstraintQueryTest.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class RevisionConstraintQueryTest : TestBase + { + + [Test] + public async Task VerifyRevisionLtQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber().Distinct()) + .Add(AuditEntity.RevisionNumber().Lt(3)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[]{1, 2}, result); + } + + [Test] + public async Task VerifyRevisionGeQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber().Distinct()) + .Add(AuditEntity.RevisionNumber().Ge(2)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[] { 2, 3, 4 }, result); + } + + [Test] + public async Task VerifyRevisionLeWithPropertyQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.RevisionNumber().Lt(3)) + .Add(AuditEntity.Property("Str").Eq("a")) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[] { 1 }, result); + } + + [Test] + public async Task VerifyRevisionGtWithPropertyQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.RevisionNumber().Gt(1)) + .Add(AuditEntity.Property("Number").Lt(10)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[] { 3, 4 }, result); + } + + [Test] + public async Task VerifyRevisionProjectionQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber().Max()) + .AddProjection(AuditEntity.RevisionNumber().Count()) + .AddProjection(AuditEntity.RevisionNumber().CountDistinct()) + .AddProjection(AuditEntity.RevisionNumber().Min()) + .Add(AuditEntity.Id().Eq(id1)) + .GetSingleResultAsync()).ConfigureAwait(false); + Assert.AreEqual(4, result[0]); + Assert.AreEqual(4, result[1]); + Assert.AreEqual(4, result[2]); + Assert.AreEqual(1, result[3]); + } + + [Test] + public async Task VerifyRevisionOrderQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.Id().Eq(id1)) + .AddOrder(AuditEntity.RevisionNumber().Desc()) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEqual(new[]{4,3,2,1}, result); + } + + [Test] + public async Task VerifyRevisionCountQueryAsync() + { + // The query shouldn't be ordered as always, otherwise - we get an exception. + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber().Count()) + .Add(AuditEntity.Id().Eq(id1)) + .GetSingleResultAsync()).ConfigureAwait(false); + Assert.AreEqual(4, result); + } + + [Test] + public async Task VerifyRevisionTypeEqQueryAsync() + { + // The query shouldn't be ordered as always, otherwise - we get an exception. + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), true, true) + .Add(AuditEntity.Id().Eq(id1)) + .Add(AuditEntity.RevisionType().Eq(RevisionType.Modified)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEqual( + new[] + { + new StrIntTestEntity {Str = "d", Number = 10, Id = id1}, + new StrIntTestEntity {Str = "d", Number = 1, Id = id1}, + new StrIntTestEntity {Str = "d", Number = 5, Id = id1} + }, result); + } + + [Test] + public async Task VerifyRevisionTypeNeQueryAsync() + { + // The query shouldn't be ordered as always, otherwise - we get an exception. + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), true, true) + .Add(AuditEntity.Id().Eq(id1)) + .Add(AuditEntity.RevisionType().Ne(RevisionType.Modified)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEqual( + new[] + { + new StrIntTestEntity {Str = "a", Number = 10, Id = id1} + }, result); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/SimpleQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/SimpleQueryTest.cs new file mode 100644 index 00000000..ea958a19 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/SimpleQueryTest.cs @@ -0,0 +1,366 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Criterion; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.Ids; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class SimpleQueryTest : TestBase + { + + [Test] + public async Task EntitiesIdQueryAsync() + { + var ver2 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof (StrIntTestEntity), 2) + .Add(AuditEntity.Id().Eq(id2)) + .GetSingleResultAsync()).ConfigureAwait(false); + Assert.AreEqual(new StrIntTestEntity { Id = id2, Str = "a", Number = 20 }, ver2); + } + + [Test] + public async Task EntitiesPropertyEqualsQueryAsync() + { + var ver1 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(StrIntTestEntity), 1) + .Add(AuditEntity.Property("Str").Eq("a")) + .GetResultListAsync()).ConfigureAwait(false); + var ver2 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(StrIntTestEntity), 2) + .Add(AuditEntity.Property("Str").Eq("a")) + .GetResultListAsync()).ConfigureAwait(false); + var ver3 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(StrIntTestEntity), 3) + .Add(AuditEntity.Property("Str").Eq("a")) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[] + { + new StrIntTestEntity {Id = id1, Str = "a", Number = 10}, + new StrIntTestEntity {Id = id2, Str = "a", Number = 10} + }, ver1); + CollectionAssert.AreEquivalent(new[] + { + new StrIntTestEntity {Id = id2, Str = "a", Number = 20} + }, ver2); + CollectionAssert.AreEquivalent(new[] + { + new StrIntTestEntity {Id = id2, Str = "a", Number = 20}, + new StrIntTestEntity {Id = id3, Str = "a", Number = 5} + }, ver3); + } + + [Test] + public async Task EntitiesPropertyLeQueryAsync() + { + var ver1 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(StrIntTestEntity), 1) + .Add(AuditEntity.Property("Number").Le(10)) + .GetResultListAsync()).ConfigureAwait(false); + var ver2 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(StrIntTestEntity), 2) + .Add(AuditEntity.Property("Number").Le(10)) + .GetResultListAsync()).ConfigureAwait(false); + var ver3 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(typeof(StrIntTestEntity), 3) + .Add(AuditEntity.Property("Number").Le(10)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[] + { + new StrIntTestEntity {Id = id1, Str = "a", Number = 10}, + new StrIntTestEntity {Id = id2, Str = "a", Number = 10}, + new StrIntTestEntity {Id = id3, Str = "b", Number = 5} + }, ver1); + CollectionAssert.AreEquivalent(new[] + { + new StrIntTestEntity {Id = id1, Str = "aBc", Number = 10}, + new StrIntTestEntity {Id = id3, Str = "b", Number = 5} + }, ver2); + CollectionAssert.AreEquivalent(new[] + { + new StrIntTestEntity {Id = id1, Str = "aBc", Number = 10}, + new StrIntTestEntity {Id = id3, Str = "a", Number = 5} + }, ver3); + } + + [Test] + public async Task RevisionsPropertyEqQueryAsync() + { + var revs_id1 = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.Property("Str").Le("a")) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + var revs_id2 = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.Property("Str").Le("a")) + .Add(AuditEntity.Id().Eq(id2)) + .GetResultListAsync()).ConfigureAwait(false); + var revs_id3 = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .Add(AuditEntity.Property("Str").Le("a")) + .Add(AuditEntity.Id().Eq(id3)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[] { 1 }, revs_id1); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, revs_id2); + CollectionAssert.AreEquivalent(new[] { 3 }, revs_id3); + } + + [Test] + public async Task RevisionsPropertyEqQueryForHistoryAsync() + { + var revs_id1 = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Property("Str").Le("a")) + .Add(AuditEntity.Id().Eq(id1)) + .ResultsAsync()).ConfigureAwait(false)).Select(x=> x.RevisionEntity.Id); + var revs_id2 = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Property("Str").Le("a")) + .Add(AuditEntity.Id().Eq(id2)) + .ResultsAsync()).ConfigureAwait(false)).Select(x => x.RevisionEntity.Id); + var revs_id3 = (await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Property("Str").Le("a")) + .Add(AuditEntity.Id().Eq(id3)) + .ResultsAsync()).ConfigureAwait(false)).Select(x => x.RevisionEntity.Id); + CollectionAssert.AreEquivalent(new[] { 1 }, revs_id1); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, revs_id2); + CollectionAssert.AreEquivalent(new[] { 3 }, revs_id3); + } + + [Test] + public async Task SelectEntitiesQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), true, false) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + CollectionAssert.AreEquivalent(new[] + { + new StrIntTestEntity {Id = id1, Str = "a", Number = 10}, + new StrIntTestEntity {Id = id1, Str = "aBc", Number = 10} + }, result); + } + + [Test] + public async Task SelectEntitiesAndRevisionsQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + + Assert.AreEqual(new StrIntTestEntity { Id = id1, Str = "a", Number = 10 }, result[0][0]); + Assert.AreEqual(new StrIntTestEntity { Id = id1, Str = "aBc", Number = 10 }, result[1][0]); + Assert.AreEqual(new StrIntTestEntity { Id = id1 }, result[2][0]); + + Assert.AreEqual(1, ((DefaultRevisionEntity)result[0][1]).Id); + Assert.AreEqual(2, ((DefaultRevisionEntity)result[1][1]).Id); + Assert.AreEqual(4, ((DefaultRevisionEntity)result[2][1]).Id); + + Assert.AreEqual(RevisionType.Added, result[0][2]); + Assert.AreEqual(RevisionType.Modified, result[1][2]); + Assert.AreEqual(RevisionType.Deleted, result[2][2]); + } + + [Test] + public async Task SelectRevisionTypeQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .AddProjection(AuditEntity.RevisionType()) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + + Assert.AreEqual(RevisionType.Added, result[0]); + Assert.AreEqual(RevisionType.Modified, result[1]); + Assert.AreEqual(RevisionType.Deleted, result[2]); + } + + [Test] + public async Task SelectRevisionTypeQueryUsingRevisionInfoAsync() + { + var result = await (AuditReader().CreateQuery().ForHistoryOf() + .Add(AuditEntity.Id().Eq(id1)) + .ResultsAsync()).ConfigureAwait(false); + result.Select(x => x.Operation).Should().Have.SameSequenceAs(RevisionType.Added, RevisionType.Modified, RevisionType.Deleted); + } + + [Test] + public async Task EmptyRevisionOfEntityQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), false, true) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(7, result.Count); + } + + [Test] + public async Task EmptyConjunctionRevisionOfEntityQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .Add(AuditEntity.Conjunction()) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(7, result.Count); + } + + [Test] + public async Task EmptyDisjunctionRevisionOfEntityQueryAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true) + .Add(AuditEntity.Disjunction()) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(0, result.Count); + } + + [Test] + public async Task ShouldFindEntitiesAddedAtRevisionAsync() + { + var result = await (AuditReader().CreateQuery() + .ForEntitiesModifiedAtRevision(typeof (StrIntTestEntity).FullName, 1) + .GetResultListAsync()).ConfigureAwait(false); + var revisionType = await (AuditReader().CreateQuery() + .ForEntitiesModifiedAtRevision(typeof(StrIntTestEntity), 1) + .AddProjection(AuditEntity.RevisionType()) + .Add(AuditEntity.Id().Eq(id1)) + .GetSingleResultAsync()).ConfigureAwait(false); + + result.Should().Have.SameValuesAs(new StrIntTestEntity {Id = id1, Str = "a", Number = 10}, + new StrIntTestEntity {Id = id2, Str = "a", Number = 10}, + new StrIntTestEntity {Id = id3, Str = "b", Number = 5}); + + revisionType.Should().Be.EqualTo(RevisionType.Added); + } + + [Test] + public async Task ShouldFindEntitiesModifiedAtRevisionAsync() + { + var result = await (AuditReader().CreateQuery() + .ForEntitiesModifiedAtRevision(typeof(StrIntTestEntity), 2) + .GetResultListAsync()).ConfigureAwait(false); + var revisionType = await (AuditReader().CreateQuery() + .ForEntitiesModifiedAtRevision(typeof(StrIntTestEntity), 2) + .AddProjection(AuditEntity.RevisionType()) + .Add(AuditEntity.Id().Eq(id1)) + .GetSingleResultAsync()).ConfigureAwait(false); + + result.Should().Have.SameValuesAs(new StrIntTestEntity { Id = id1, Str = "aBc", Number = 10 }, + new StrIntTestEntity { Id = id2, Str = "a", Number = 20 }); + + revisionType.Should().Be.EqualTo(RevisionType.Modified); + } + + [Test] + public async Task ShouldFindEntitiesRemovedAtRevisionAsync() + { + var result = await (AuditReader().CreateQuery() + .ForEntitiesModifiedAtRevision(typeof(StrIntTestEntity).FullName, 4) + .GetResultListAsync()).ConfigureAwait(false); + var revisionType = await (AuditReader().CreateQuery() + .ForEntitiesModifiedAtRevision(typeof(StrIntTestEntity), 4) + .AddProjection(AuditEntity.RevisionType()) + .Add(AuditEntity.Id().Eq(id1)) + .GetSingleResultAsync()).ConfigureAwait(false); + + result.Should().Have.SameValuesAs(new StrIntTestEntity { Id = id1 }); + + revisionType.Should().Be.EqualTo(RevisionType.Deleted); + } + + [Test] + public async Task VerifyEntityNotModifiedAtRevisionAsync() + { + var result = await (AuditReader().CreateQuery() + .ForEntitiesModifiedAtRevision(typeof(StrIntTestEntity), 3) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + result.Should().Be.Empty(); + } + + [Test] + public async Task VerifyNoEntitiesModifiedAtRevisionAsync() + { + var result = await (AuditReader().CreateQuery() + .ForEntitiesModifiedAtRevision(typeof(StrIntTestEntity).FullName, 5) + .GetResultListAsync()).ConfigureAwait(false); + result.Should().Be.Empty(); + } + + [Test] + public async Task VerifyBetweenInsideDisjunctionAsync() + { + var result = await (AuditReader().CreateQuery() + .ForRevisionsOf() + .Add(AuditEntity.Disjunction() + .Add(AuditEntity.Property("Number").Between(0, 5)) + .Add(AuditEntity.Property("Number").Between(20, 100))) + .ResultsAsync()).ConfigureAwait(false); + foreach (var number in result.Select(entity => entity.Number)) + { + Assert.That(number, Is.InRange(0, 5).Or.InRange(20, 100)); + } + } + + [Test] + public async Task VerifyInsensitiveLikeAsync() + { + var site1 = new StrIntTestEntity {Id = id1, Number = 10, Str = "aBc"}; + (await (AuditReader().CreateQuery() + .ForRevisionsOf(false) + .Add(AuditEntity.Property("Str").InsensitiveLike("abc")) + .SingleAsync()).ConfigureAwait(false)) + .Should().Be.EqualTo(site1); + } + + [Test] + public async Task VerifyInsensitiveLikeWithMatchModeAsync() + { + var site1 = new StrIntTestEntity { Id = id1, Number = 10, Str = "aBc" }; + (await (AuditReader().CreateQuery() + .ForRevisionsOf(false) + .Add(AuditEntity.Property("Str").InsensitiveLike("BC", MatchMode.Anywhere)) + .SingleAsync()).ConfigureAwait(false)) + .Should().Be.EqualTo(site1); + } + + [Test] + public async Task VerifyIdPropertyRestrictionAsync() + { + var ver2 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(2) + .Add(AuditEntity.Property("Id").Eq(id2)) + .SingleAsync()).ConfigureAwait(false); + ver2.Number.Should().Be.EqualTo(20); + ver2.Str.Should().Be.EqualTo("a"); + } + + [Test] + public async Task VerifyEmbeddedIdPropertyRestrictionAsync() + { + var ver2 = await (AuditReader().CreateQuery() + .ForEntitiesAtRevision(2) + .Add(AuditEntity.Property("Id.X").Eq(embId.X)) + .Add(AuditEntity.Property("Id.Y").Eq(embId.Y)) + .SingleAsync()).ConfigureAwait(false); + ver2.Str1.Should().Be.EqualTo("something"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/StoreDeletedDataTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/StoreDeletedDataTest.cs new file mode 100644 index 00000000..3ee176e4 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/StoreDeletedDataTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Query +{ + using System.Threading.Tasks; + public partial class StoreDeletedDataTest : TestBase + { + + [Test] + public async Task VerifyRevisionsPropertyEqQueryAsync() + { + var revsId1 = await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (StrIntTestEntity), false, true) + .Add(AuditEntity.Id().Eq(id1)) + .GetResultListAsync()).ConfigureAwait(false); + Assert.AreEqual(2, revsId1.Count); + Assert.AreEqual(new StrIntTestEntity { Str = "a", Number = 10, Id=id1 }, revsId1[0][0]); + Assert.AreEqual(new StrIntTestEntity { Str = "a", Number = 10, Id = id1 }, revsId1[1][0]); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Query/Traverse/AssociationToOneQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Query/Traverse/AssociationToOneQueryTest.cs new file mode 100644 index 00000000..3a64cb37 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Query/Traverse/AssociationToOneQueryTest.cs @@ -0,0 +1,155 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NHibernate.Envers.Query; +using NHibernate.SqlCommand; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Query.Traverse +{ + using System.Threading.Tasks; + public partial class AssociationToOneQueryTest : TestBase + { + + + [Test] + public async Task ShouldTraverseAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1) + .TraverseRelation("Owner", JoinType.InnerJoin) + .Add(AuditEntity.Property("Name").Like("Ford%")).SingleAsync()).ConfigureAwait(false)) + .Id.Should().Be.EqualTo(fordId); + } + + [Test] + public async Task ShouldDoMultipleTraverseAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1) + .TraverseRelation("Owner", JoinType.InnerJoin) + .TraverseRelation("Address", JoinType.InnerJoin) + .Add(AuditEntity.Property("Number").Eq(20)).SingleAsync()).ConfigureAwait(false)) + .Id.Should().Be.EqualTo(toyotaId); + } + + [Test] + public async Task ShouldTraverseWithUpListAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1) + .TraverseRelation("Owner", JoinType.InnerJoin) + .Add(AuditEntity.Property("Age").Ge(30)) + .Add(AuditEntity.Property("Age").Lt(40)) + .Up() + .AddOrder(AuditEntity.Property("Make").Asc()) + .ResultsAsync()).ConfigureAwait(false)).Select(x => x.Id) + .Should().Have.SameSequenceAs(fordId, toyotaId); + } + + [Test] + public async Task ShouldTraverseWithUpAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(2) + .TraverseRelation("Owner", JoinType.InnerJoin) + .Add(AuditEntity.Property("Age").Ge(30)) + .Add(AuditEntity.Property("Age").Lt(40)) + .Up() + .AddOrder(AuditEntity.Property("Make").Asc()).SingleAsync()).ConfigureAwait(false)) + .Id.Should().Be.EqualTo(fordId); + } + + [Test] + public async Task ShouldOrderOnUpAscendingAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1) + .TraverseRelation("Owner", JoinType.InnerJoin) + .TraverseRelation("Address", JoinType.InnerJoin) + .AddOrder(AuditEntity.Property("Number").Asc()) + .Up() + .AddOrder(AuditEntity.Property("Age").Asc()) + .ResultsAsync()).ConfigureAwait(false)).Select(x => x.Id) + .Should().Have.SameSequenceAs(vwId, fordId, toyotaId); + } + + [Test] + public async Task ShouldOrderOnUpDescendingAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(1) + .TraverseRelation("Owner", JoinType.InnerJoin) + .TraverseRelation("Address", JoinType.InnerJoin) + .AddOrder(AuditEntity.Property("Number").Asc()) + .Up() + .AddOrder(AuditEntity.Property("Age").Desc()) + .ResultsAsync()).ConfigureAwait(false)).Select(x => x.Id) + .Should().Have.SameSequenceAs(fordId, vwId, toyotaId); + } + + [Test] + public async Task ShouldDoProjectionAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof (Car), 2) + .TraverseRelation("Owner", JoinType.InnerJoin) + .AddProjection(AuditEntity.Property("Age")) + .AddOrder(AuditEntity.Property("Age").Asc()) + .GetResultListAsync()).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(20, 30, 40); + } + + [Test] + public async Task ShouldDoProjectionOnTraversedPropertyNotDistinctAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(Car), 2) + .TraverseRelation("Owner", JoinType.InnerJoin) + .AddOrder(AuditEntity.Property("Age").Asc()) + .TraverseRelation("Address", JoinType.InnerJoin) + .AddProjection(AuditEntity.SelectEntity(false)) + .GetResultListAsync
()).ConfigureAwait(false)).Select(x => x.Id) + .Should().Have.SameSequenceAs(addressId1, addressId1, addressId2); + } + + [Test] + public async Task ShouldDoProjectionOnTraversedPropertyDistinctAsync() + { + (await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(Car), 2) + .TraverseRelation("Owner", JoinType.InnerJoin) + .TraverseRelation("Address", JoinType.InnerJoin) + .AddProjection(AuditEntity.SelectEntity(true)) + .AddOrder(AuditEntity.Property("Number").Asc()) + .GetResultListAsync
()).ConfigureAwait(false)).Select(x => x.Id) + .Should().Have.SameSequenceAs(addressId1, addressId2); + } + + [Test] + public async Task ShouldDoMultipleProjectionsAsync() + { + var result = await (AuditReader().CreateQuery().ForEntitiesAtRevision(typeof(Car), 2) + .TraverseRelation("Owner", JoinType.InnerJoin) + .AddOrder(AuditEntity.Property("Age").Asc()) + .AddProjection(AuditEntity.SelectEntity(false)) + .TraverseRelation("Address", JoinType.InnerJoin) + .AddProjection(AuditEntity.Property("Number")) + .GetResultListAsync()).ConfigureAwait(false); + + result.Count.Should().Be.EqualTo(3); + + var index0 = (object[]) result[0]; + ((Person) index0[0]).Id.Should().Be.EqualTo(vwOwnerId); + index0[1].Should().Be.EqualTo(5); + + var index1 = (object[])result[1]; + ((Person)index1[0]).Id.Should().Be.EqualTo(fordOwnerId); + index1[1].Should().Be.EqualTo(5); + + var index2 = (object[])result[2]; + ((Person)index2[0]).Id.Should().Be.EqualTo(toyotaOwnerId); + index2[1].Should().Be.EqualTo(20); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomColumnMappingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomColumnMappingTest.cs new file mode 100644 index 00000000..897f86ae --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomColumnMappingTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Threading; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class CustomColumnMappingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x" }; + var ver2 = new StrTestEntity { Id = id, Str = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomDateTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomDateTest.cs new file mode 100644 index 00000000..04530df6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomDateTest.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Threading; +using NHibernate.Dialect; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class CustomDateTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x" }; + var ver2 = new StrTestEntity { Id = id, Str = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomFieldAccessTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomFieldAccessTest.cs new file mode 100644 index 00000000..5b61de71 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomFieldAccessTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Threading; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class CustomFieldAccessTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x" }; + var ver2 = new StrTestEntity { Id = id, Str = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomFieldCamelcaseAccessTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomFieldCamelcaseAccessTest.cs new file mode 100644 index 00000000..f0a183fd --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomFieldCamelcaseAccessTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Threading; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class CustomFieldCamelcaseAccessTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x" }; + var ver2 = new StrTestEntity { Id = id, Str = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomNoListenerTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomNoListenerTest.cs new file mode 100644 index 00000000..5a1ec7af --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomNoListenerTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class CustomNoListenerTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[]{1,2,4}, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity {Id = id, Str = "x"}; + var ver2 = new StrTestEntity {Id = id, Str = "y"}; + var ver3 = new StrTestEntity {Id = id, Str = "z"}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false)); + Assert.AreEqual(ver3, await (AuditReader().FindAsync(id, 4)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomTest.cs new file mode 100644 index 00000000..bf667d7b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/CustomTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class CustomTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity),id)).ConfigureAwait(false)); + } + + + [Test] + public async Task VerifyHistoryOfAsync() + { + var rev1timestamp = (await (AuditReader().CreateQuery().ForHistoryOf().ResultsAsync()).ConfigureAwait(false)).First() + .RevisionEntity.CustomTimestamp; + Assert.IsTrue(rev1timestamp > timestamp1.Ticks); + Assert.IsTrue(rev1timestamp <= timestamp2.Ticks); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x" }; + var ver2 = new StrTestEntity { Id = id, Str = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/ExceptionListenerTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/ExceptionListenerTest.cs new file mode 100644 index 00000000..e5e594ab --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/ExceptionListenerTest.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class ExceptionListenerTest : TestBase + { + + [Test] + public async Task EntityShouldNotHaveBeenPersistedAsync() + { + Assert.AreEqual(0, await (Session.CreateQuery("select count(s) from StrTestEntity s where s.Str='x'").UniqueResultAsync()).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/InheritedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/InheritedTest.cs new file mode 100644 index 00000000..0406ee4a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/InheritedTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Threading; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class InheritedTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[]{1,2}, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity {Id = id, Str = "x"}; + var ver2 = new StrTestEntity {Id = id, Str = "y"}; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/ListenerTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/ListenerTest.cs new file mode 100644 index 00000000..01151a96 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/ListenerTest.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Threading; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.Envers.Tests.Tools; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.RevEntity +{ + using System.Threading.Tasks; + public partial class ListenerTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIdAsync() + { + var ver1 = new StrTestEntity { Id = id, Str = "x" }; + var ver2 = new StrTestEntity { Id = id, Str = "y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/TrackModifiedEntities/DefaultTrackingEntitiesTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/TrackModifiedEntities/DefaultTrackingEntitiesTest.cs new file mode 100644 index 00000000..4174ac0a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/TrackModifiedEntities/DefaultTrackingEntitiesTest.cs @@ -0,0 +1,129 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.RevEntity.TrackModifiedEntities +{ + using System.Threading.Tasks; + public partial class DefaultTrackingEntitiesTest : TestBase + { + + [Test] + public async Task ShouldTrackAddedEntitiesAsync() + { + var ste = new StrTestEntity{Str = "x", Id = steId}; + var site = new StrIntTestEntity {Str = "y", Number = 1, Id = siteId}; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(1)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(ste, site); + } + + [Test] + public async Task ShouldTrackModifiedEntitiesAsync() + { + var site = new StrIntTestEntity { Str = "y", Number = 2, Id = siteId }; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(2)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(site); + } + + [Test] + public async Task ShouldTrackDeletedEntitiesAsync() + { + var ste = new StrTestEntity { Id = steId }; + var site = new StrIntTestEntity { Id = siteId }; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(3)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(site, ste); + } + + [Test] + public async Task ShouldNotFindChangesInInvalidRevisionAsync() + { + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(4)).ConfigureAwait(false)) + .Should().Be.Empty(); + } + + [Test] + public async Task ShouldTrackAddedEntitiesGroupByRevisionTypeAsync() + { + var ste = new StrTestEntity { Str = "x", Id = steId }; + var site = new StrIntTestEntity { Str = "y", Number = 1, Id = siteId }; + + var result = await (crossTypeRevisionChangesReader().FindEntitiesGroupByRevisionTypeAsync(1)).ConfigureAwait(false); + + result[RevisionType.Added].Should().Have.SameValuesAs(site, ste); + result[RevisionType.Modified].Should().Be.Empty(); + result[RevisionType.Deleted].Should().Be.Empty(); + } + + [Test] + public async Task ShouldTrackModifiedEntitiesGroupByRevisionTypeAsync() + { + var site = new StrIntTestEntity { Str = "y", Number = 2, Id = siteId }; + + var result = await (crossTypeRevisionChangesReader().FindEntitiesGroupByRevisionTypeAsync(2)).ConfigureAwait(false); + + result[RevisionType.Added].Should().Be.Empty(); + result[RevisionType.Modified].Should().Have.SameValuesAs(site); + result[RevisionType.Deleted].Should().Be.Empty(); + } + + [Test] + public async Task ShouldTrackDeletedEntitiesGroupByRevisionTypeAsync() + { + var ste = new StrTestEntity { Id = steId }; + var site = new StrIntTestEntity { Id = siteId }; + + var result = await (crossTypeRevisionChangesReader().FindEntitiesGroupByRevisionTypeAsync(3)).ConfigureAwait(false); + + result[RevisionType.Added].Should().Be.Empty(); + result[RevisionType.Modified].Should().Be.Empty(); + result[RevisionType.Deleted].Should().Have.SameValuesAs(ste, site); + } + + [Test] + public async Task ShouldFindChangedEntitiesByRevisionTypeAddAsync() + { + var ste = new StrTestEntity { Str = "x", Id = steId }; + var site = new StrIntTestEntity { Str = "y", Number = 1, Id = siteId }; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(1, RevisionType.Added)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(ste, site); + } + + [Test] + public async Task ShouldFindChangedEntitiesByRevisionTypeModifiedAsync() + { + var site = new StrIntTestEntity { Str = "y", Number = 2, Id = siteId }; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(2, RevisionType.Modified)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(site); + } + + [Test] + public async Task ShouldFindChangedEntitiesByRevisionTypeDeletedAsync() + { + var ste = new StrTestEntity { Id = steId }; + var site = new StrIntTestEntity { Id = siteId }; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(3, RevisionType.Deleted)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(site, ste); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/TrackModifiedEntities/TrackingEntitiesMultipleChangesTest .cs b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/TrackModifiedEntities/TrackingEntitiesMultipleChangesTest .cs new file mode 100644 index 00000000..1c55ded3 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/RevEntity/TrackModifiedEntities/TrackingEntitiesMultipleChangesTest .cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.RevEntity.TrackModifiedEntities +{ + using System.Threading.Tasks; + public partial class TrackingEntitiesMultipleChangesTest : TestBase + { + + [Test] + public async Task ShouldTrackAddedTwoEntitiesAsync() + { + var ste1 = new StrTestEntity { Str = "x", Id = steId1 }; + var ste2 = new StrTestEntity { Str = "y", Id = steId2 }; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(1)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(ste1, ste2); + } + + [Test] + public async Task ShouldTrackUpdateAndRemoveDifferentEntitiesAsync() + { + var ste1 = new StrTestEntity { Str = "z", Id = steId1 }; + var ste2 = new StrTestEntity { Id = steId2 }; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(2)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(ste1, ste2); + } + + [Test] + public async Task ShouldTrackUpdateAndRemoveTheSameEntityAsync() + { + var ste1 = new StrTestEntity { Id = steId1 }; + + (await (crossTypeRevisionChangesReader().FindEntitiesAsync(3)).ConfigureAwait(false)) + .Should().Have.SameValuesAs(ste1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/SameIds/SameIdsTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/SameIds/SameIdsTest.cs new file mode 100644 index 00000000..1d440176 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/SameIds/SameIdsTest.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.SameIds +{ + using System.Threading.Tasks; + public partial class SameIdsTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(SameIdTestEntity1), 1)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(SameIdTestEntity2), 1)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfSite1Async() + { + var ver1 = new SameIdTestEntity1 { Id = 1, Str1 = "str1" }; + var ver2 = new SameIdTestEntity1 { Id = 1, Str1 = "str2" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(1, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfSite2Async() + { + var ver1 = new SameIdTestEntity2 { Id = 1, Str1 = "str1" }; + var ver2 = new SameIdTestEntity2 { Id = 1, Str1 = "str2" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(1, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(1, 2)).ConfigureAwait(false)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Serialization/SerializingCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Serialization/SerializingCollectionTest.cs new file mode 100644 index 00000000..7c0965ac --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Serialization/SerializingCollectionTest.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Serialization +{ + using System.Threading.Tasks; + public partial class SerializingCollectionTest : TestBase + { + + [Test] + public async Task VerifyDetachedAsync() + { + var ing1 = await (Session.GetAsync(ing1_id)).ConfigureAwait(false); + var rev1 = await (AuditReader().FindAsync(ed1_id, 1)).ConfigureAwait(false); + + // First forcing loading of the collection + Assert.AreEqual(1, rev1.Reffering.Count); + + // Now serializing and de-serializing the object + rev1 = serializeObject(rev1); + + // And checking the collection again + CollectionAssert.AreEqual(new[]{ing1}, rev1.Reffering); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/IdentifierReuseTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/IdentifierReuseTest.cs new file mode 100644 index 00000000..f0d1833c --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/IdentifierReuseTest.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Tests.Entities.ManyToMany; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Strategy +{ + using System.Threading.Tasks; + public partial class IdentifierReuseTest :TestBase + { + + [Test] + public async Task VerifyIdentifierReuseAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (IntNoAutoIdTestEntity), reusedId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3, 4, 5, 6); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyComponentCollectionRevEndTest .cs b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyComponentCollectionRevEndTest .cs new file mode 100644 index 00000000..68e187cc --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyComponentCollectionRevEndTest .cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Tests.Integration.Strategy.Model; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Strategy +{ + using System.Threading.Tasks; + public partial class ValidityAuditStrategyComponentCollectionRevEndTest : ValidityTestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Product), productId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3); + } + + [Test] + public async Task VerifyRevision1Async() + { + var product = await (AuditReader().FindAsync(productId, 1)).ConfigureAwait(false); + product.Items.Single().Name.Should().Be.EqualTo("bread"); + } + + [Test] + public async Task VerifyRevision2Async() + { + var product = await (AuditReader().FindAsync(productId, 2)).ConfigureAwait(false); + product.Items.Select(x => x.Name) + .Should().Have.SameSequenceAs("bread", "bread2"); + } + + [Test] + public async Task VerifyRevision3Async() + { + var product = await (AuditReader().FindAsync(productId, 3)).ConfigureAwait(false); + product.Items.Single().Name.Should().Be.EqualTo("bread2"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyManyToManyTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyManyToManyTest.cs new file mode 100644 index 00000000..cce2cc6e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyManyToManyTest.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.ManyToMany; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Strategy +{ + using System.Threading.Tasks; + public partial class ValidityAuditStrategyManyToManyTest : ValidityTestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4, 5 }, await (AuditReader().GetRevisionsAsync(typeof(SetOwningEntity),ingId)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4, 5 }, await (AuditReader().GetRevisionsAsync(typeof(SetOwnedEntity),edId)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfIngAsync() + { + var ed = new SetOwnedEntity {Id = edId, Data = "child"}; + + (await (AuditReader().FindAsync(ingId, 1)).ConfigureAwait(false)).References.Should().Be.Empty(); + (await (AuditReader().FindAsync(ingId, 2)).ConfigureAwait(false)).References.Should().Have.SameSequenceAs(ed); + (await (AuditReader().FindAsync(ingId, 3)).ConfigureAwait(false)).References.Should().Be.Empty(); + (await (AuditReader().FindAsync(ingId, 4)).ConfigureAwait(false)).References.Should().Have.SameSequenceAs(ed); + (await (AuditReader().FindAsync(ingId, 5)).ConfigureAwait(false)).References.Should().Be.Empty(); + + } + + [Test] + public async Task VerifyHistoryOfEdAsync() + { + var ing = new SetOwningEntity { Id = ingId, Data = "parent" }; + + (await (AuditReader().FindAsync(edId, 1)).ConfigureAwait(false)).Referencing.Should().Be.Empty(); + (await (AuditReader().FindAsync(edId, 2)).ConfigureAwait(false)).Referencing.Should().Have.SameSequenceAs(ing); + (await (AuditReader().FindAsync(edId, 3)).ConfigureAwait(false)).Referencing.Should().Be.Empty(); + (await (AuditReader().FindAsync(edId, 4)).ConfigureAwait(false)).Referencing.Should().Have.SameSequenceAs(ing); + (await (AuditReader().FindAsync(edId, 5)).ConfigureAwait(false)).Referencing.Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyRevEndTestCustomRevEntTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyRevEndTestCustomRevEntTest.cs new file mode 100644 index 00000000..5e8c6c59 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyRevEndTestCustomRevEntTest.cs @@ -0,0 +1,174 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using System.Text; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Tests.Entities.ManyToMany.SameTable; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.SqlTypes; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Strategy +{ + using System.Threading.Tasks; + public partial class ValidityAuditStrategyRevEndTestCustomRevEntTest : ValidityTestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(ParentEntity), p1_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3, 4); + (await (AuditReader().GetRevisionsAsync(typeof(ParentEntity), p2_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3, 4); + + (await (AuditReader().GetRevisionsAsync(typeof(Child1Entity), c1_1_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof(Child1Entity), c1_2_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 5); + + (await (AuditReader().GetRevisionsAsync(typeof(Child2Entity), c2_1_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + (await (AuditReader().GetRevisionsAsync(typeof(Child2Entity), c2_2_id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 5); + } + + [Test] + public async Task VerifyHistoryOfParent1Async() + { + var c1_1 = await (Session.GetAsync(c1_1_id)).ConfigureAwait(false); + var c1_2 = await (Session.GetAsync(c1_2_id)).ConfigureAwait(false); + var c2_2 = await (Session.GetAsync(c2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(p1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(p1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(p1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(p1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(p1_id, 5)).ConfigureAwait(false); + + rev1.Children1.Should().Be.Empty(); + rev2.Children1.Should().Have.SameValuesAs(c1_1); + rev3.Children1.Should().Have.SameValuesAs(c1_1, c1_2); + rev4.Children1.Should().Have.SameValuesAs(c1_2); + rev5.Children1.Should().Be.Empty(); + + rev1.Children2.Should().Be.Empty(); + rev2.Children2.Should().Be.Empty(); + rev3.Children2.Should().Have.SameValuesAs(c2_2); + rev4.Children2.Should().Have.SameValuesAs(c2_2); + rev5.Children2.Should().Have.SameValuesAs(c2_2); + } + + [Test] + public async Task VerifyHistoryOfParent2Async() + { + var c1_1 = await (Session.GetAsync(c1_1_id)).ConfigureAwait(false); + var c2_1 = await (Session.GetAsync(c2_1_id)).ConfigureAwait(false); + var c2_2 = await (Session.GetAsync(c2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(p2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(p2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(p2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(p2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(p2_id, 5)).ConfigureAwait(false); + + rev1.Children1.Should().Be.Empty(); + rev2.Children1.Should().Be.Empty(); + rev3.Children1.Should().Have.SameValuesAs(c1_1); + rev4.Children1.Should().Have.SameValuesAs(c1_1); + rev5.Children1.Should().Have.SameValuesAs(c1_1); + + rev1.Children2.Should().Be.Empty(); + rev2.Children2.Should().Have.SameValuesAs(c2_1); + rev3.Children2.Should().Have.SameValuesAs(c2_1); + rev4.Children2.Should().Have.SameValuesAs(c2_1, c2_2); + rev5.Children2.Should().Have.SameValuesAs(c2_1); + } + + [Test] + public async Task VerifyHistoryOfChild1_1Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c1_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c1_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c1_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c1_1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c1_1_id, 5)).ConfigureAwait(false); + + rev1.Parents.Should().Be.Empty(); + rev2.Parents.Should().Have.SameValuesAs(p1); + rev3.Parents.Should().Have.SameValuesAs(p1, p2); + rev4.Parents.Should().Have.SameValuesAs(p2); + rev5.Parents.Should().Have.SameValuesAs(p2); + } + + [Test] + public async Task VerifyHistoryOfChild1_2Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c1_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c1_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c1_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c1_2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c1_2_id, 5)).ConfigureAwait(false); + + rev1.Parents.Should().Be.Empty(); + rev2.Parents.Should().Be.Empty(); + rev3.Parents.Should().Have.SameValuesAs(p1); + rev4.Parents.Should().Have.SameValuesAs(p1); + rev5.Parents.Should().Be.Empty(); + } + + [Test] + public async Task VerifyHistoryOfChild2_1Async() + { + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c2_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c2_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c2_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c2_1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c2_1_id, 5)).ConfigureAwait(false); + + rev1.Parents.Should().Be.Empty(); + rev2.Parents.Should().Have.SameValuesAs(p2); + rev3.Parents.Should().Have.SameValuesAs(p2); + rev4.Parents.Should().Have.SameValuesAs(p2); + rev5.Parents.Should().Have.SameValuesAs(p2); + } + + [Test] + public async Task VerifyHistoryOfChild2_2Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c2_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c2_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c2_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c2_2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c2_2_id, 5)).ConfigureAwait(false); + + rev1.Parents.Should().Be.Empty(); + rev2.Parents.Should().Be.Empty(); + rev3.Parents.Should().Have.SameValuesAs(p1); + rev4.Parents.Should().Have.SameValuesAs(p1, p2); + rev5.Parents.Should().Have.SameValuesAs(p1); + } + + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyRevEndTimestampTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyRevEndTimestampTest.cs new file mode 100644 index 00000000..f57e3fba --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Strategy/ValidityAuditStrategyRevEndTimestampTest.cs @@ -0,0 +1,169 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using NHibernate.Cfg; +using NHibernate.Dialect; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Tests.Entities.ManyToMany.SameTable; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NHibernate.SqlTypes; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.Strategy +{ + using System.Threading.Tasks; + public partial class ValidityAuditStrategyRevEndTimestampTest : ValidityTestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity),p1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity),p2_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Child1Entity),c1_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 5 }, await (AuditReader().GetRevisionsAsync(typeof(Child1Entity),c1_2_id)).ConfigureAwait(false)); + + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Child2Entity),c2_1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 5 }, await (AuditReader().GetRevisionsAsync(typeof(Child2Entity),c2_2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfParent1Async() + { + var c1_1 = await (Session.GetAsync(c1_1_id)).ConfigureAwait(false); + var c1_2 = await (Session.GetAsync(c1_2_id)).ConfigureAwait(false); + var c2_2 = await (Session.GetAsync(c2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(p1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(p1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(p1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(p1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(p1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1 }, rev2.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1, c1_2 }, rev3.Children1); + CollectionAssert.AreEquivalent(new[] { c1_2 }, rev4.Children1); + CollectionAssert.IsEmpty(rev5.Children1); + + CollectionAssert.IsEmpty(rev1.Children2); + CollectionAssert.IsEmpty(rev2.Children2); + CollectionAssert.AreEquivalent(new[] { c2_2 }, rev3.Children2); + CollectionAssert.AreEquivalent(new[] { c2_2 }, rev4.Children2); + CollectionAssert.AreEquivalent(new[] { c2_2 }, rev5.Children2); + } + + [Test] + public async Task VerifyHistoryOfParent2Async() + { + var c1_1 = await (Session.GetAsync(c1_1_id)).ConfigureAwait(false); + var c2_1 = await (Session.GetAsync(c2_1_id)).ConfigureAwait(false); + var c2_2 = await (Session.GetAsync(c2_2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(p2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(p2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(p2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(p2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(p2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Children1); + CollectionAssert.IsEmpty(rev2.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1 }, rev3.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1 }, rev4.Children1); + CollectionAssert.AreEquivalent(new[] { c1_1 }, rev5.Children1); + + CollectionAssert.IsEmpty(rev1.Children2); + CollectionAssert.AreEquivalent(new[] { c2_1 }, rev2.Children2); + CollectionAssert.AreEquivalent(new[] { c2_1 }, rev3.Children2); + CollectionAssert.AreEquivalent(new[] { c2_1, c2_2 }, rev4.Children2); + CollectionAssert.AreEquivalent(new[] { c2_1 }, rev5.Children2); + } + + [Test] + public async Task VerifyHistoryOfChild1_1Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c1_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c1_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c1_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c1_1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c1_1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev2.Parents); + CollectionAssert.AreEquivalent(new[] { p1, p2 }, rev3.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev4.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev5.Parents); + } + + [Test] + public async Task VerifyHistoryOfChild1_2Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c1_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c1_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c1_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c1_2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c1_2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Parents); + CollectionAssert.IsEmpty(rev2.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev3.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev4.Parents); + CollectionAssert.IsEmpty(rev5.Parents); + } + + [Test] + public async Task VerifyHistoryOfChild2_1Async() + { + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c2_1_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c2_1_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c2_1_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c2_1_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c2_1_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev2.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev3.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev4.Parents); + CollectionAssert.AreEquivalent(new[] { p2 }, rev5.Parents); + } + + [Test] + public async Task VerifyHistoryOfChild2_2Async() + { + var p1 = await (Session.GetAsync(p1_id)).ConfigureAwait(false); + var p2 = await (Session.GetAsync(p2_id)).ConfigureAwait(false); + + var rev1 = await (AuditReader().FindAsync(c2_2_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(c2_2_id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(c2_2_id, 3)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(c2_2_id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(c2_2_id, 5)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev1.Parents); + CollectionAssert.IsEmpty(rev2.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev3.Parents); + CollectionAssert.AreEquivalent(new[] { p1, p2 }, rev4.Parents); + CollectionAssert.AreEquivalent(new[] { p1 }, rev5.Parents); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs new file mode 100644 index 00000000..46081bb9 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditAtMethodSuperclassLevel.AuditAllSubclass +{ + using System.Threading.Tasks; + public partial class MappedSubclassingAllAuditedTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsForAuditedAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (AuditedAllSubclassEntity), id1_1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryOfAuditedAsync() + { + var ver1 = new AuditedAllSubclassEntity { Id = id1_1, Str = "ae", OtherStr = "super str", SubAuditedStr = "audited str" }; + var ver2 = new AuditedAllSubclassEntity { Id = id1_1, Str = "ae new", OtherStr = "super str", SubAuditedStr = "audited str new" }; + + var rev1 = await (AuditReader().FindAsync(id1_1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(id1_1, 2)).ConfigureAwait(false); + + //this property is not audited on superclass + rev1.OtherStr.Should().Be.Null(); + rev2.OtherStr.Should().Be.Null(); + + rev1.Should().Be.EqualTo(ver1); + rev2.Should().Be.EqualTo(ver2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs new file mode 100644 index 00000000..afc887c4 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditAtMethodSuperclassLevel.AuditMethodSubclass +{ + using System.Threading.Tasks; + public partial class MappedSubclassingMethodAuditedTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsForAuditedAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(AuditedMethodSubclassEntity), id1_1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryOfAuditedAsync() + { + var ver1 = new AuditedMethodSubclassEntity { Id = id1_1, Str = "ae", OtherStr = "super str", SubAuditedStr = "audited str" }; + var ver2 = new AuditedMethodSubclassEntity { Id = id1_1, Str = "ae new", OtherStr = "super str", SubAuditedStr = "audited str new" }; + + var rev1 = await (AuditReader().FindAsync(id1_1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(id1_1, 2)).ConfigureAwait(false); + + //this property is not audited on superclass + rev1.OtherStr.Should().Be.Null(); + rev2.OtherStr.Should().Be.Null(); + + rev1.Should().Be.EqualTo(ver1); + rev2.Should().Be.EqualTo(ver2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/AuditClassOverrideTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/AuditClassOverrideTest.cs new file mode 100644 index 00000000..74285c23 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/AuditClassOverrideTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditOverride +{ + using System.Threading.Tasks; + public partial class AuditClassOverrideTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfClassOverrideAuditedEntityAsync() + { + var ver1 = new ClassOverrideAuditedEntity {Id = classAuditedEntityId, Number1 = 1, Str1 = "data 1", Str2 = "data 2"}; + (await (AuditReader().FindAsync(classAuditedEntityId, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + } + + [Test] + public async Task VerifyHistoryOfClassOverrideNotAuditedEntityAsync() + { + var ver1 = new ClassOverrideNotAuditedEntity { Id = classNotAuditedEntityId, Number1 = 0, Str1 = null, Str2 = "data 2" }; + (await (AuditReader().FindAsync(classNotAuditedEntityId, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/AuditPropertyOverrideTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/AuditPropertyOverrideTest.cs new file mode 100644 index 00000000..a54a5175 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/AuditPropertyOverrideTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditOverride +{ + using System.Threading.Tasks; + public partial class AuditPropertyOverrideTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfPropertyOverrideEntityAsync() + { + var ver1 = new PropertyOverrideTestEntity {Id = propertyEntityId, Number1 = 1, Str1 = null, Str2 = "data 2"}; + (await (AuditReader().FindAsync(propertyEntityId, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + } + + [Test] + public async Task VerifyHistoryOfTransitiveOverrideEntityAsync() + { + var ver1 = new TransitiveOverrideTestEntity { Id = transitiveEntityId, Number1 = 1, Number2 = 2, Str1 = "data 1", Str2 = "data 2", Str3 = "data 3"}; + (await (AuditReader().FindAsync(transitiveEntityId, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + } + + [Test] + public async Task VerifyHistoryOfAuditedSpecialEntityAsync() + { + var ver1 = new AuditedSpecialEntity { Id = auditedEntityId, Number1 = 0, Str1 = "data 1", Str2 = "data 2" }; + (await (AuditReader().FindAsync(auditedEntityId, 3)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/MixedOverrideTest .cs b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/MixedOverrideTest .cs new file mode 100644 index 00000000..9e4e1bd4 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditOverride/MixedOverrideTest .cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Mapping; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditOverride +{ + using System.Threading.Tasks; + public partial class MixedOverrideTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfMixedEntityAsync() + { + var ver1 = new MixedOverrideEntity {Id = mixedEntityId, Number1 = 1, Str1 = null, Str2 = "data 2"}; + (await (AuditReader().FindAsync(mixedEntityId, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditedAtSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditedAtSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs new file mode 100644 index 00000000..21290528 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditedAtSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditedAtSuperclassLevel.AuditAllSubclass +{ + using System.Threading.Tasks; + public partial class MappedSubclassingAllAuditedTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsForAuditedAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(AuditedAllSubclassEntity), id1_1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryOfAuditedAsync() + { + var ver1 = new AuditedAllSubclassEntity { Id = id1_1, Str = "ae", OtherStr = "super str", SubAuditedStr = "audited str" }; + var ver2 = new AuditedAllSubclassEntity { Id = id1_1, Str = "ae new", OtherStr = "super str", SubAuditedStr = "audited str new" }; + + var rev1 = await (AuditReader().FindAsync(id1_1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(id1_1, 2)).ConfigureAwait(false); + + rev1.OtherStr.Should().Be.EqualTo(ver1.OtherStr); + rev2.OtherStr.Should().Be.EqualTo(ver2.OtherStr); + + rev1.Should().Be.EqualTo(ver1); + rev2.Should().Be.EqualTo(ver2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditedAtSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditedAtSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs new file mode 100644 index 00000000..7356ba34 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/SuperClass/AuditedAtSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditedAtSuperclassLevel.AuditMethodSubclass +{ + using System.Threading.Tasks; + public partial class MappedSubclassingMethodAuditedTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsForAuditedAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(AuditedMethodSubclassEntity), id1_1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryOfAuditedAsync() + { + var ver1 = new AuditedMethodSubclassEntity { Id = id1_1, Str = "ae", OtherStr = "super str", SubAuditedStr = "audited str" }; + var ver2 = new AuditedMethodSubclassEntity { Id = id1_1, Str = "ae new", OtherStr = "super str", SubAuditedStr = "audited str new" }; + + var rev1 = await (AuditReader().FindAsync(id1_1, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(id1_1, 2)).ConfigureAwait(false); + + rev1.OtherStr.Should().Be.EqualTo(ver1.OtherStr); + rev2.OtherStr.Should().Be.EqualTo(ver2.OtherStr); + + rev1.Should().Be.EqualTo(ver1); + rev2.Should().Be.EqualTo(ver2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Versioning/NoOptimisticLockAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Versioning/NoOptimisticLockAuditingTest.cs new file mode 100644 index 00000000..53974a3b --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Versioning/NoOptimisticLockAuditingTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Versioning +{ + using System.Threading.Tasks; + public partial class NoOptimisticLockAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(OptimisticLockEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new OptimisticLockEntity { Id = id, Str = "X" }; + var ver2 = new OptimisticLockEntity { Id = id, Str = "Y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyVersionedIsNotAuditedAsync() + { + var versionOf1 = (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Version; + var versionOf2 = (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).Version; + + Assert.AreEqual(0, versionOf1); + Assert.AreEqual(0, versionOf2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/Integration/Versioning/OptimisticLockAuditingTest.cs b/Src/NHibernate.Envers.Tests/Async/Integration/Versioning/OptimisticLockAuditingTest.cs new file mode 100644 index 00000000..fda4ee08 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/Integration/Versioning/OptimisticLockAuditingTest.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.Integration.Versioning +{ + using System.Threading.Tasks; + public partial class OptimisticLockAuditingTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(OptimisticLockEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1 = new OptimisticLockEntity { Id = id, Str = "X" }; + var ver2 = new OptimisticLockEntity { Id = id, Str = "Y" }; + + Assert.AreEqual(ver1, await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)); + Assert.AreEqual(ver2, await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyVersionedIsAuditedAsync() + { + var versionOf1 = (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Version; + var versionOf2 = (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).Version; + + Assert.AreEqual(versionOf1 +1, versionOf2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/None/ManyToOne/Fixture.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/None/ManyToOne/Fixture.cs new file mode 100644 index 00000000..48d012eb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/None/ManyToOne/Fixture.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NHibernate.Envers.Query; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Access.None.ManyToOne +{ + using System.Threading.Tasks; + public partial class Fixture : TestBase + { + + [Test] + public async Task VerifyHistoryOfComponentAsync() + { + var ver1 = await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false); + var ver2 = await (AuditReader().FindAsync(parentId, 2)).ConfigureAwait(false); + + ver1.Children.Count.Should().Be.EqualTo(1); + ver2.Children.Count.Should().Be.EqualTo(2); + } + + + [Test] + public async Task CanQueryOnAccessNonePropertyAsync() + { + (await (AuditReader().CreateQuery() + .ForHistoryOf() + .Add(AuditEntity.Property("ParentId").Eq(parentId)) + .ResultsAsync()).ConfigureAwait(false)) + .Count().Should().Be.EqualTo(2); + } + + [Test] + public async Task CanQueryOnAccessNoneManyToOneAsync() + { + var parent = new Parent {Id = parentId}; + (await (AuditReader().CreateQuery() + .ForHistoryOf() + .Add(AuditEntity.Property("Parent2").Eq(parent)) + .ResultsAsync()).ConfigureAwait(false)) + .Count().Should().Be.EqualTo(2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/None/SimpleProperty/Fixture.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/None/SimpleProperty/Fixture.cs new file mode 100644 index 00000000..9cece179 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/None/SimpleProperty/Fixture.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using NHibernate.Envers.Query; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Access.None.SimpleProperty +{ + using System.Threading.Tasks; + public partial class Fixture : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEqual(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(Entity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfComponentAsync() + { + var ver1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + var ver2 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + + ver1.Data.Should().Be.EqualTo(1); + + ver2.Data.Should().Be.EqualTo(2); + } + + [Test] + public async Task CanQueryOnAccessNoneDataAsync() + { + var res = (IList)await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (Entity), false, false) + .Add(AuditEntity.Property("Data2").Eq(2)) + .GetSingleResultAsync()).ConfigureAwait(false); + + var ent = (Entity) res[0]; + var rev = (DefaultRevisionEntity) res[1]; + + rev.Id.Should().Be.EqualTo(2); + ent.Data.Should().Be.EqualTo(2); + } + + [Test] + public async Task CanQueryOnAccessNoopDataAsync() + { + var res = (IList)await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof(Entity), false, false) + .Add(AuditEntity.Property("Data3").Eq(2)) + .GetSingleResultAsync()).ConfigureAwait(false); + + var ent = (Entity)res[0]; + var rev = (DefaultRevisionEntity)res[1]; + + rev.Id.Should().Be.EqualTo(2); + ent.Data.Should().Be.EqualTo(2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/Readonly/ReadonlyAccessTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/Readonly/ReadonlyAccessTest.cs new file mode 100644 index 00000000..57e57355 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Access/Readonly/ReadonlyAccessTest.cs @@ -0,0 +1,57 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using NHibernate.Envers.Query; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Access.Readonly +{ + using System.Threading.Tasks; + public partial class ReadonlyAccessTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEqual(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ReadonlyEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfComponentAsync() + { + var ver1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + var ver2 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + + ver1.Data.Should().Be.EqualTo(1); + ver1.ReadonlyData.Should().Be.EqualTo(0); + + ver2.Data.Should().Be.EqualTo(2); + ver2.ReadonlyData.Should().Be.EqualTo(0); + } + + [Test] + public async Task CanQueryOnReadonlyDataAsync() + { + var res = (IList)await (AuditReader().CreateQuery() + .ForRevisionsOfEntity(typeof (ReadonlyEntity), false, false) + .Add(AuditEntity.Property("ReadonlyData").Eq(2)) + .GetSingleResultAsync()).ConfigureAwait(false); + + var ent = (ReadonlyEntity) res[0]; + var rev = (DefaultRevisionEntity) res[1]; + + rev.Id.Should().Be.EqualTo(2); + ent.Data.Should().Be.EqualTo(2); + ent.ReadonlyData.Should().Be.EqualTo(0); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BiDirOneToOneWithOneSideNotAudited/BiDirOneToOneWithOneSideNotAuditedTests.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BiDirOneToOneWithOneSideNotAudited/BiDirOneToOneWithOneSideNotAuditedTests.cs new file mode 100644 index 00000000..7f73fad5 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BiDirOneToOneWithOneSideNotAudited/BiDirOneToOneWithOneSideNotAuditedTests.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Linq; +using NHibernate.Envers.Query; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.BiDirOneToOneWithOneSideNotAudited +{ + using System.Threading.Tasks; + public partial class BiDirOneToOneWithOneSideNotAuditedTests : TestBase + { + + [Test] + public void QueryHistoryShouldNotThrowAsync() + { + Assert.DoesNotThrowAsync(async () => + { + (await (AuditReader().CreateQuery().ForRevisionsOf().ResultsAsync()).ConfigureAwait(false)).ToList(); + }); + } + + [Test] + public async Task QueryHistoryReturnAllRevisionsAsync() + { + var parentRevisions = (await (AuditReader().CreateQuery().ForRevisionsOf() + .Add(AuditEntity.Id().Eq(parentId)) + .ResultsAsync()).ConfigureAwait(false)).ToList(); + + Assert.AreEqual(3, parentRevisions.Count); + } + + [Test] + public async Task ParentsHistoricalVersionsPointsToCurrentNotAuditedChildAsync() + { + var parentRevisions = (await (AuditReader().CreateQuery().ForRevisionsOf() + .Add(AuditEntity.Id().Eq(parentId)) + .ResultsAsync()).ConfigureAwait(false)).ToList(); + + foreach (var revision in parentRevisions) + { + Assert.AreEqual(childLatestStr, revision.Child.Str); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BidirectionalList/DifferentAccessTest/BidirectionalListWithDifferentAccessTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BidirectionalList/DifferentAccessTest/BidirectionalListWithDifferentAccessTest.cs new file mode 100644 index 00000000..97d5123d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BidirectionalList/DifferentAccessTest/BidirectionalListWithDifferentAccessTest.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.BidirectionalList.DifferentAccessTest +{ + using System.Threading.Tasks; + public partial class BidirectionalListWithDifferentAccessTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, await (AuditReader().GetRevisionsAsync(typeof(Parent), parent_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(Child), child1_id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(Child), child2_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfParent1Async() + { + var child1 = new Child {Id = child1_id}; + var child2 = new Child {Id = child2_id}; + + var ver1 = await (AuditReader().FindAsync(parent_id, 1)).ConfigureAwait(false); + ver1.Children[0].Should().Be.EqualTo(child1); + ver1.Children[1].Should().Be.EqualTo(child2); + } + + [Test] + public async Task VerifyHistoryOfParent2Async() + { + var child1 = new Child { Id = child1_id }; + var child2 = new Child { Id = child2_id }; + + var ver1 = await (AuditReader().FindAsync(parent_id, 2)).ConfigureAwait(false); + ver1.Children[1].Should().Be.EqualTo(child1); + ver1.Children[0].Should().Be.EqualTo(child2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BidirectionalSameColumn/TwoRelationEndsSameColumnTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BidirectionalSameColumn/TwoRelationEndsSameColumnTest.cs new file mode 100644 index 00000000..9d7c3fdd --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/BidirectionalSameColumn/TwoRelationEndsSameColumnTest.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.BidirectionalSameColumn +{ + using System.Threading.Tasks; + public partial class TwoRelationEndsSameColumnTest : TestBase + { + + + [Test] + public async Task ShouldAuditModelProperlyAsync() + { + var modelFromAudit = await (Session.Auditer().CreateQuery() + .ForRevisionsOf().SingleAsync()).ConfigureAwait(false); + + Assert.AreEqual(modelId, modelFromAudit.Id); + Assert.AreEqual(modelConfigurationId, modelFromAudit.ModelConfigurations.Single().Id); + Assert.AreEqual(modelId, modelFromAudit.ModelConfigurations.Single().Model.Id); + } + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Component/DerivedComponentTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Component/DerivedComponentTest.cs new file mode 100644 index 00000000..93229cfd --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Component/DerivedComponentTest.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Component +{ + using System.Threading.Tasks; + public partial class DerivedComponentTest : TestBase + { + + [Test] + public async Task VerifyActualBaseClassOwnerAsync() + { + var owner = await (Session.GetAsync(id)).ConfigureAwait(false); + Assert.That(owner.Component, Is.Not.Null); + Assert.That(owner.Component.Data1, Is.EqualTo("2")); + } + + [Test] + public async Task VerifyHistoryOfBaseClassOwnerAsync() + { + var owner = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + Assert.That(owner.Component, Is.Null); + owner = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + Assert.That(owner.Component, Is.Not.Null); + Assert.That(owner.Component.Data1, Is.EqualTo("1")); + owner = await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false); + Assert.That(owner.Component, Is.Not.Null); + Assert.That(owner.Component.Data1, Is.EqualTo("2")); + } + + [Test] + public async Task VerifyActualDerivedClassOwnerAsync() + { + var owner = await (Session.GetAsync(id)).ConfigureAwait(false); + Assert.That(owner.Component, Is.Not.Null); + Assert.That(owner.Component.Data1, Is.EqualTo("2")); + } + + [Test] + public async Task VerifyHistoryOfDerivedClassOwnerAsync() + { + var owner = await (AuditReader().FindAsync(id, 4)).ConfigureAwait(false); + Assert.That(owner.Component, Is.Null); + owner = await (AuditReader().FindAsync(id, 5)).ConfigureAwait(false); + Assert.That(owner.Component, Is.Not.Null); + Assert.That(owner.Component.Data1, Is.EqualTo("1")); + owner = await (AuditReader().FindAsync(id, 6)).ConfigureAwait(false); + Assert.That(owner.Component, Is.Not.Null); + Assert.That(owner.Component.Data1, Is.EqualTo("2")); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Component/SimpleStructTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Component/SimpleStructTest.cs new file mode 100644 index 00000000..2fa162bc --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Component/SimpleStructTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Component +{ + using System.Threading.Tasks; + public partial class SimpleStructTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEqual(new[] {1, 2, 3}, await (AuditReader().GetRevisionsAsync(typeof(ComponentOwner),id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfComponentAsync() + { + var ver1 = new StructComponent(); + var ver2 = new StructComponent { Data1 = "1", NestedComponent = new StructComponent2 { Data2 = 1 } }; + var ver3 = new StructComponent { Data1 = "2", NestedComponent = new StructComponent2 { Data2 = 2 } }; + + + Assert.AreEqual(ver1, (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Component); + Assert.AreEqual(ver2, (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).Component); + Assert.AreEqual(ver3, (await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false)).Component); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ComponentAsId/ComponentAsIdTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ComponentAsId/ComponentAsIdTest.cs new file mode 100644 index 00000000..7b0cca50 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ComponentAsId/ComponentAsIdTest.cs @@ -0,0 +1,112 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using NHibernate.Envers.Query; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.ComponentAsId +{ + using System.Threading.Tasks; + using System.Threading; + public partial class ComponentAsIdTest : TestBase + { + + [Test] + public void ComponentAsIdTestMethodAsync() + { + Assert.DoesNotThrowAsync(async () => + { + var ent1 = new Entity1 + { + Id = 1 + }; + + await (SaveAsync(ent1)).ConfigureAwait(false); + + var ent2 = new Entity2() + { + Id = 1 + }; + + await (SaveAsync(ent2)).ConfigureAwait(false); + + var udf = new SomeEntUDF + { + Id = new ComponentAsId + { + Key1 = ent1, + Key2 = ent2 + } + }; + + await (SaveAsync(udf)).ConfigureAwait(false); + + await (DelAsync(udf)).ConfigureAwait(false); + await (DelAsync(ent1)).ConfigureAwait(false); + }); + } + + [Test] + public async Task ComponentAsIdGetAuditAsync() + { + var ent1 = new Entity1 + { + Id = 1 + }; + + await (SaveAsync(ent1)).ConfigureAwait(false); + + var ent2 = new Entity2() + { + Id = 1 + }; + + await (SaveAsync(ent2)).ConfigureAwait(false); + + var udf = new SomeEntUDF + { + Id = new ComponentAsId + { + Key1 = ent1, + Key2 = ent2 + }, + }; + + await (SaveAsync(udf)).ConfigureAwait(false); + + + var history = await (Session.Auditer().CreateQuery() + .ForRevisionsOfEntity(typeof(SomeEntUDF), false, true) + .Add(AuditEntity.Property("Id.Key1.Id").Eq(ent1.Id)) + .GetResultListAsync()).ConfigureAwait(false); + + Assert.AreEqual(1, history.Count); + + } + + async Task SaveAsync(object o, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var tran = Session.BeginTransaction()) + { + await (Session.SaveAsync(o, cancellationToken)).ConfigureAwait(false); + await (tran.CommitAsync(cancellationToken)).ConfigureAwait(false); + } + } + + async Task DelAsync(object o, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var tran = Session.BeginTransaction()) + { + await (Session.DeleteAsync(o, cancellationToken)).ConfigureAwait(false); + await (tran.CommitAsync(cancellationToken)).ConfigureAwait(false); + } + } + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Configuration/NoRevisionOnCollectionChangeTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Configuration/NoRevisionOnCollectionChangeTest.cs new file mode 100644 index 00000000..ff5dfb57 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Configuration/NoRevisionOnCollectionChangeTest.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Tests.Entities.OneToMany.Detached; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Configuration +{ + using System.Threading.Tasks; + public partial class NoRevisionOnCollectionChangeTest : TestBase + { + + [Test] + public async Task ShouldOnlyCreatedOneRevisionForParentAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(IndexedListJoinColumnBidirectionalRefIngEntity), parentId)).ConfigureAwait(false)) + .Should().Have.Count.EqualTo(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Configuration/SchemaForAbstractUnionSubclassTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Configuration/SchemaForAbstractUnionSubclassTest.cs new file mode 100644 index 00000000..88f10175 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Configuration/SchemaForAbstractUnionSubclassTest.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.Interfaces.Inheritance.PropertiesAudited; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Configuration +{ + using System.Threading.Tasks; + public partial class SchemaForAbstractUnionSubclassTest : TestBase + { + + [Test] + public async Task ShouldBeAbleToQueryBaseTypeAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Should().Not.Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Ctor/NonPublicCtorTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Ctor/NonPublicCtorTest.cs new file mode 100644 index 00000000..d2a860ee --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Ctor/NonPublicCtorTest.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Ctor +{ + using System.Threading.Tasks; + public partial class NonPublicCtorTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(NonPublicCtorEntity),id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfRefComponentAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Component.Name + .Should().Be.EqualTo("first"); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).Component.Name + .Should().Be.EqualTo("second"); + } + + [Test] + public async Task VerifyHistoryOfStructComponentAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).StructComponent.Value + .Should().Be.EqualTo(1); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).StructComponent.Value + .Should().Be.EqualTo(2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomMapping/ImplicitEnversCollectionType/Fixture.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomMapping/ImplicitEnversCollectionType/Fixture.cs new file mode 100644 index 00000000..88b3aff3 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomMapping/ImplicitEnversCollectionType/Fixture.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.CustomMapping.ImplicitEnversCollectionType +{ + using System.Threading.Tasks; + public partial class Fixture : TestBase + { + + [Test] + public async Task VerifyNhCoreMappingAsync() + { + var entity = await (Session.GetAsync(parentId)).ConfigureAwait(false); + entity.Children.Count + .Should().Be.EqualTo(2); + } + + [Test] + public async Task VerifyRevision1Async() + { + var entity = await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false); + entity.Children.Count + .Should().Be.EqualTo(1); + } + + [Test] + public async Task VerifyRevision2Async() + { + var entity = await (AuditReader().FindAsync(parentId, 2)).ConfigureAwait(false); + entity.Children.Count + .Should().Be.EqualTo(2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomMapping/UserCollection/ParameterizedUserCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomMapping/UserCollection/ParameterizedUserCollectionTest.cs new file mode 100644 index 00000000..6e174e5f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomMapping/UserCollection/ParameterizedUserCollectionTest.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.CustomMapping.UserCollection +{ + using System.Threading.Tasks; + public partial class ParameterizedUserCollectionTest : TestBase + { + + [Test] + public async Task VerifyNhCoreMappingAsync() + { + var entity = await (Session.GetAsync(id)).ConfigureAwait(false); + entity.SpecialCollection.ItemsOverLimit() + .Should().Be.EqualTo(3); + } + + [Test] + public async Task VerifyRevision1Async() + { + var rev1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + rev1.SpecialCollection.ItemsOverLimit() + .Should().Be.EqualTo(1); + } + + [Test] + public async Task VerifyRevision2Async() + { + var rev1 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + rev1.SpecialCollection.ItemsOverLimit() + .Should().Be.EqualTo(3); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomType/CLOBCustomTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomType/CLOBCustomTest.cs new file mode 100644 index 00000000..0b50d95d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/CustomType/CLOBCustomTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Dialect; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.CustomType +{ + using System.Threading.Tasks; + public partial class CLOBCustomTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(CLOBCustomTypeEntity), ccte_id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfCcteAsync() + { + var rev1 = await (AuditReader().FindAsync(ccte_id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(ccte_id, 2)).ConfigureAwait(false); + + Assert.AreEqual("U", rev1.Str); + Assert.AreEqual("V", rev2.Str); + } + + [Test] + public async Task VerifyLengthOfCcteAsync() + { + var rev3 = await (AuditReader().FindAsync(ccte_id, 3)).ConfigureAwait(false); + + Assert.AreEqual(20000, rev3.Str.Length); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/AddAndRemovePropertyTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/AddAndRemovePropertyTest.cs new file mode 100644 index 00000000..ebee9fd2 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/AddAndRemovePropertyTest.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.DynamicComponent +{ + using System.Threading.Tasks; + public partial class AddAndRemovePropertyTest : TestBase + { + + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (DynamicTestEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var rev1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false); + + rev1.Properties.Count.Should().Be.EqualTo(1); + rev2.Properties.Count.Should().Be.EqualTo(1); + rev3.Properties.Should().Be.Null(); + + rev1.Properties["Name"].Should().Be.EqualTo("1"); + rev2.Properties["Name"].Should().Be.EqualTo("2"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/JoinWithDynamicComponent/BasicJoinWithDynamicComponentTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/JoinWithDynamicComponent/BasicJoinWithDynamicComponentTest.cs new file mode 100644 index 00000000..e70727f1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/JoinWithDynamicComponent/BasicJoinWithDynamicComponentTest.cs @@ -0,0 +1,64 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.DynamicComponent.JoinWithDynamicComponent +{ + using System.Threading.Tasks; + using System.Threading; + public partial class BasicJoinWithDynamicComponentTest : TestBase + { + + private async Task loadDataOnSessionAndAuditReaderAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + currentCar1 = await (Session.GetAsync(id_car1, cancellationToken)).ConfigureAwait(false); + currentPerson1 = (Person)await (Session.GetAsync("Person", id_pers1, cancellationToken)).ConfigureAwait(false); + car1 = await (AuditReader().FindAsync(id_car1, 1, cancellationToken)).ConfigureAwait(false); + person1 = car1.Owner; + } + + private async Task checkEntitiesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + currentPerson1.Age.Should().Not.Be.EqualTo(person1.Age); + + var person2 = (Person)await (Session.GetAsync("Person", id_pers2, cancellationToken)).ConfigureAwait(false); + var car2 = await (AuditReader().FindAsync(id_car2, 2, cancellationToken)).ConfigureAwait(false); + var person2_1 = car2.Owner; + person2.Age.Should().Be.EqualTo(person2_1.Age); + } + + private async Task checkEntityNamesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + AuditReader().GetEntityName(id_car1, 1, car1) + .Should().Be.EqualTo(await (Session.GetEntityNameAsync(currentCar1, cancellationToken)).ConfigureAwait(false)); + AuditReader().GetEntityName(id_pers1, 1, person1) + .Should().Be.EqualTo("Person"); + } + + [Test] + public async Task ShouldGetAssociationWithEntityNameAsync() + { + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntitiesAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + + [Test] + public async Task ShouldGetAssociationWithEntityNameInNewSessionAsync() + { + ForceNewSession(); + await (loadDataOnSessionAndAuditReaderAsync()).ConfigureAwait(false); + await (checkEntitiesAsync()).ConfigureAwait(false); + await (checkEntityNamesAsync()).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/MultiplePropertyTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/MultiplePropertyTest.cs new file mode 100644 index 00000000..7093855d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/MultiplePropertyTest.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.DynamicComponent +{ + using System.Threading.Tasks; + public partial class MultiplePropertyTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(DynamicTestEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyRevision1Async() + { + var rev = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + + rev.Properties["Prop1"].Should().Be.EqualTo(1); + rev.Properties["Prop2"].Should().Be.EqualTo(2); + rev.Properties["Prop3"].Should().Be.EqualTo(3); + } + + [Test] + public async Task VerifyRevision2Async() + { + var rev = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + + rev.Properties["Prop1"].Should().Be.EqualTo(1); + rev.Properties["Prop2"].Should().Be.EqualTo(2); + rev.Properties["Prop3"].Should().Be.EqualTo(33); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/NonExistingKeyTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/NonExistingKeyTest.cs new file mode 100644 index 00000000..e005d514 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/DynamicComponent/NonExistingKeyTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.DynamicComponent +{ + using System.Threading.Tasks; + public partial class NonExistingKeyTest : TestBase + { + + [Test] + public async Task VerifyRevision1Async() + { + var rev = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + rev.Properties.Should().Be.Null(); + } + + [Test] + public async Task VerifyRevision2Async() + { + var rev = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + rev.Properties["Prop1"].Should().Be.EqualTo(1); + rev.Properties["Prop2"].Should().Be.EqualTo(2); + rev.Properties["Prop3"].Should().Be.EqualTo(3); + } + + [Test] + public async Task VerifyRevision3Async() + { + var rev = await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false); + rev.Properties.Contains("Prop1").Should().Be.False(); + rev.Properties["Prop2"].Should().Be.EqualTo(2); + rev.Properties["Prop3"].Should().Be.EqualTo(3); + } + + [Test] + public async Task VerifyRevision4Async() + { + var rev = await (AuditReader().FindAsync(id, 4)).ConfigureAwait(false); + rev.Properties.Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/EntityInstantiation/FactoryTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/EntityInstantiation/FactoryTest.cs new file mode 100644 index 00000000..20cf0bf1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/EntityInstantiation/FactoryTest.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using NHibernate.Envers.Configuration; +using NHibernate.Cfg; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.EntityInstantiation +{ + using System.Threading.Tasks; + public partial class FactoryTest : TestBase + { + + [Test] + public async Task VerifyCreatedByFactoryAsync() + { + var ent = await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false); + Assert.IsTrue(ent.CreatedByFactory); + } + + [Test] + public async Task VerifyNotCreatedByFactoryAsync() + { + var ent = await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false); + Assert.IsFalse(ent.CreatedByFactory); + } + + [Test] + public async Task VerifyContextAssignedByListenerAsync() + { + var ent1 = await (AuditReader().FindAsync(id1, 1)).ConfigureAwait(false); + var ent2 = await (AuditReader().FindAsync(id2, 1)).ConfigureAwait(false); + + Assert.IsNotNull(ent1.Context); + Assert.IsNotNull(ent2.Context); + } + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/EnumType/CustomEnumTypeTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/EnumType/CustomEnumTypeTest.cs new file mode 100644 index 00000000..402f908a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/EnumType/CustomEnumTypeTest.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.EnumType +{ + using System.Threading.Tasks; + public partial class CustomEnumTypeTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Entity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + } + + [Test] + public async Task VerifyHistoryOfEntityAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).EntityEnum.Should().Be.EqualTo(EntityEnum.TypeB); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ForceInitialize/ForceInitializeTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ForceInitialize/ForceInitializeTest.cs new file mode 100644 index 00000000..fa6ff9fb --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ForceInitialize/ForceInitializeTest.cs @@ -0,0 +1,95 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.ForceInitialize +{ + using System.Threading.Tasks; + public partial class ForceInitializeTest : TestBase + { + + [Test] + public async Task InitializeManyToOneNullAsync() + { + var parent = await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false); + NHibernateUtil.IsInitialized(parent.RelatedEntity).Should().Be.True(); + parent.RelatedEntity.Should().Be.Null(); + } + + [Test] + public async Task InitializeOneToManyEmptyAsync() + { + var parent = await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false); + + NHibernateUtil.IsInitialized(parent.Children).Should().Be.False(); + await (NHibernateUtil.InitializeAsync(parent.Children)).ConfigureAwait(false); + NHibernateUtil.IsInitialized(parent.Children).Should().Be.True(); + + parent.Children.Should().Be.Empty(); + } + + [Test] + public async Task InitializeOneToManyNotEmptyAsync() + { + var parent = await (AuditReader().FindAsync(parentId, 3)).ConfigureAwait(false); + + NHibernateUtil.IsInitialized(parent.Children).Should().Be.False(); + await (NHibernateUtil.InitializeAsync(parent.Children)).ConfigureAwait(false); + NHibernateUtil.IsInitialized(parent.Children).Should().Be.True(); + + var children = parent.Children.ToList(); + children.Should().Have.Count.EqualTo(1); + children[0].Id.Should().Be.EqualTo(child1Id); + children[0].Str.Should().Be.EqualTo("1_2"); + } + + [Test] + public async Task CanReuseCollectionProxyAsNormalEntityAsync() + { + using (var tx = Session.BeginTransaction()) + { + var ver3 = await (AuditReader().FindAsync(parentId, 3)).ConfigureAwait(false); + ver3.Children.First().Str = "1_3"; + var newChild = new Child { Str = "2_1" }; + ver3.Children.Add(newChild); + await (Session.MergeAsync(ver3)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + using (Session.BeginTransaction()) + { + var afterMerge = await (Session.GetAsync(parentId)).ConfigureAwait(false); + afterMerge.Children.Count.Should().Be.EqualTo(2); + afterMerge.Children.First().Id.Should().Be.EqualTo(child1Id); + afterMerge.Children.First().Str.Should().Be.EqualTo("1_3"); + afterMerge.Children.Last().Str.Should().Be.EqualTo("2_1"); + } + } + + [Test] + public async Task NoUpdatesIfMergingNonChangingEntityAsync() + { + using (var tx = Session.BeginTransaction()) + { + var ver3 = await (AuditReader().FindAsync(parentId, 3)).ConfigureAwait(false); + await (Session.MergeAsync(ver3)).ConfigureAwait(false); + Session.SessionFactory.Statistics.Clear(); + await (tx.CommitAsync()).ConfigureAwait(false); + + Session.SessionFactory.Statistics.PrepareStatementCount + .Should().Be.EqualTo(0); + } + } + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/Fixture.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/Fixture.cs new file mode 100644 index 00000000..9b66f310 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/Fixture.cs @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.IdBag.ManyToMany.UniDirectional +{ + using System.Threading.Tasks; + public partial class Fixture : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(UniOwning), owningId1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2, 3); + (await (AuditReader().GetRevisionsAsync(typeof(UniOwning), owningId2)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + + (await (AuditReader().GetRevisionsAsync(typeof(UniOwned), ownedId1)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(2); + (await (AuditReader().GetRevisionsAsync(typeof(UniOwned), ownedId2)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(2); + } + + [Test] + public async Task VerifyHistoryOfOwning1Async() + { + var owned1 = new UniOwned { Id = ownedId1, Number = 1 }; + var owned2 = new UniOwned { Id = ownedId2, Number = 2 }; + + (await (AuditReader().FindAsync(owningId1, 1)).ConfigureAwait(false)) + .Referencing.Should().Be.Empty(); + (await (AuditReader().FindAsync(owningId1, 2)).ConfigureAwait(false)) + .Referencing.Should().Have.SameValuesAs(owned1, owned2); + (await (AuditReader().FindAsync(owningId1, 3)).ConfigureAwait(false)) + .Referencing.Should().Have.SameValuesAs(owned2); + } + + [Test] + public async Task VerifyHistoryOfOwning2Async() + { + var owned1 = new UniOwned { Id = ownedId1, Number = 1 }; + + (await (AuditReader().FindAsync(owningId2, 1)).ConfigureAwait(false)) + .Referencing.Should().Be.Empty(); + (await (AuditReader().FindAsync(owningId2, 2)).ConfigureAwait(false)) + .Referencing.Should().Have.SameValuesAs(owned1); + } + + + [Test] + public async Task CanReuseAsNormalEntityAsync() + { + using (var tx = Session.BeginTransaction()) + { + var ver3 = await (AuditReader().FindAsync(owningId1, 3)).ConfigureAwait(false); + ver3.Referencing.First().Number = 5; + await (Session.MergeAsync(ver3)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + using (Session.BeginTransaction()) + { + (await (Session.GetAsync(ownedId2)).ConfigureAwait(false)).Number.Should().Be.EqualTo(5); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/FixtureWithModifiedFlagTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/FixtureWithModifiedFlagTest.cs new file mode 100644 index 00000000..b200e454 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/FixtureWithModifiedFlagTest.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using NHibernate.Envers.Configuration; +using NUnit.Framework; +using SharpTestsEx; +using NHibernate.Cfg; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.IdBag.ManyToMany.UniDirectional +{ + using System.Threading.Tasks; + public partial class FixtureWithModifiedFlagTest : TestBase + { + + [Test] + public async Task VerifyRevisionsCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(UniOwning), owningId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + (await (AuditReader().GetRevisionsAsync(typeof(UniOwned), ownedId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Inheritance/Discriminator/Discriminate/DiscriminatorTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Inheritance/Discriminator/Discriminate/DiscriminatorTest.cs new file mode 100644 index 00000000..26879a98 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Inheritance/Discriminator/Discriminate/DiscriminatorTest.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Inheritance.Discriminator.Discriminate +{ + using System.Threading.Tasks; + public partial class DiscriminatorTest : TestBase + { + + /// + /// Verify that revisions match for each type + /// + [Test] + public async Task VerifyRevisionCountsAsync() + { + CollectionAssert.AreEquivalent(new[] { 2, 3 }, + await (AuditReader().GetRevisionsAsync(typeof(BaseEntity), baseEntityVer1.Id)).ConfigureAwait(false)); + CollectionAssert.AreEquivalent(new[] { 2, 3 }, + await (AuditReader().GetRevisionsAsync(typeof(SubtypeEntity), subtypeEntityVer1.Id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + (await (AuditReader().FindAsync(baseEntityVer1.Id, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(baseEntityVer1); + + (await (AuditReader().FindAsync(baseEntityVer2.Id, 3)).ConfigureAwait(false)) + .Should().Be.EqualTo(baseEntityVer2); + } + + [Test] + public async Task VerifyHistoryOfChildAsync() + { + (await (AuditReader().FindAsync(subtypeEntityVer1.Id, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(subtypeEntityVer1); + + (await (AuditReader().FindAsync(subtypeEntityVer2.Id, 3)).ConfigureAwait(false)) + .Should().Be.EqualTo(subtypeEntityVer2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/InsertUpdateFalse/InsertUpdateFalseComponentTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/InsertUpdateFalse/InsertUpdateFalseComponentTest.cs new file mode 100644 index 00000000..a9931572 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/InsertUpdateFalse/InsertUpdateFalseComponentTest.cs @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.InsertUpdateFalse +{ + using System.Threading.Tasks; + public partial class InsertUpdateFalseComponentTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(ParentEntity),id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var expected1 = new ParentEntity + { + Id = id, + Component = new ChildComponent {NoUpdateInsert = 0}, + ComponentSetter = new ChildComponent {NoUpdateInsert = 0} + }; + var expected2 = new ParentEntity + { + Id = id, + Component = new ChildComponent {NoUpdateInsert = 3}, + ComponentSetter = new ChildComponent {NoUpdateInsert = 3} + }; + + var ver1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + var ver2 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + + ver1.Should().Be.EqualTo(expected1); + ver2.Should().Be.EqualTo(expected2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedCollection/NoAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedCollection/NoAuditedCollectionTest.cs new file mode 100644 index 00000000..c75c0c21 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedCollection/NoAuditedCollectionTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Join.NoAuditedCollection +{ + using System.Threading.Tasks; + public partial class NoAuditedCollectionTest : TestBase + { + + [Test] + public async Task VerifyRevision1Async() + { + var rev1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + rev1.Number.Should().Be.EqualTo(1); + rev1.XCollection.Should().Be.Null(); + } + + [Test] + public async Task VerifyRevision2Async() + { + var rev1 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + rev1.Number.Should().Be.EqualTo(2); + rev1.XCollection.Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedCollectionWithAudited/NoAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedCollectionWithAudited/NoAuditedCollectionTest.cs new file mode 100644 index 00000000..25678a8e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedCollectionWithAudited/NoAuditedCollectionTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Join.NoAuditedCollectionWithAudited +{ + using System.Threading.Tasks; + public partial class NoAuditedCollectionTest : TestBase + { + + [Test] + public async Task VerifyRevision1Async() + { + var rev1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + rev1.Number.Should().Be.EqualTo(1); + rev1.XCollection.Should().Be.Null(); + } + + [Test] + public async Task VerifyRevision2Async() + { + var rev1 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + rev1.Number.Should().Be.EqualTo(2); + rev1.XCollection.Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedProperties/NoAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedProperties/NoAuditedCollectionTest.cs new file mode 100644 index 00000000..aa7bec09 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Join/NoAuditedProperties/NoAuditedCollectionTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Join.NoAuditedProperties +{ + using System.Threading.Tasks; + public partial class NoAuditedCollectionTest : TestBase + { + + [Test] + public async Task VerifyRevision1Async() + { + var rev1 = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + rev1.Number.Should().Be.EqualTo(0); + rev1.XCollection.Should().Be.Null(); + } + + [Test] + public async Task VerifyRevision2Async() + { + var rev1 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + rev1.Number.Should().Be.EqualTo(0); + rev1.XCollection.Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/JoinAuditTable/MultipleJoinAuditTableTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/JoinAuditTable/MultipleJoinAuditTableTest.cs new file mode 100644 index 00000000..7447c1a4 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/JoinAuditTable/MultipleJoinAuditTableTest.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.JoinAuditTable +{ + using System.Threading.Tasks; + public partial class MultipleJoinAuditTableTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2 }, await (AuditReader().GetRevisionsAsync(typeof(Animal),id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistoryOfOwningAsync() + { + var ver1 = new Animal { Id = id}; + var ver2 = new Animal { Id = id, Height = 14, Weight = 45}; + + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver1); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)) + .Should().Be.EqualTo(ver2); + } + + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ManyToMany/WithModifiedFlag/SaveNewItemTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ManyToMany/WithModifiedFlag/SaveNewItemTest.cs new file mode 100644 index 00000000..36a12a0a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ManyToMany/WithModifiedFlag/SaveNewItemTest.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Tests.Integration.Inheritance.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.ManyToMany.WithModifiedFlag +{ + using System.Threading.Tasks; + public partial class SaveNewItemTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Person), id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ManyToOne/LazyProperty/LazyPropertyTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ManyToOne/LazyProperty/LazyPropertyTest.cs new file mode 100644 index 00000000..6748c4d0 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ManyToOne/LazyProperty/LazyPropertyTest.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.ManyToOne.LazyProperty +{ + using System.Threading.Tasks; + public partial class LazyPropertyTest : TestBase + { + + [Test] + public async Task SavePersonProxyForFieldInterceptorAsync() + { + long carId; + using (var tx = Session.BeginTransaction()) + { + var pers = Session.Query().Single(x => x.Id == id_pers1); + var car = new Car + { + Owner = pers + }; + carId = (long) await (Session.SaveAsync(car)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + + (await (AuditReader().FindAsync(carId, 2)).ConfigureAwait(false)).Owner.Name + .Should().Be.EqualTo("Hernan"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Merge/AddEditCollectionItemTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Merge/AddEditCollectionItemTest.cs new file mode 100644 index 00000000..d4a230f3 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Merge/AddEditCollectionItemTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Merge +{ + using System.Threading.Tasks; + public partial class AddEditCollectionItemTest : TestBase + { + + [Test] + public async Task RevisionForOwnedAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(SetRefEdEntity), entityId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1,2); + } + + + [Test] + public async Task RevisionForChildAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(SetRefIngEntity), childId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ModifiedFlags/CollectionItemChangingParent/Fixture.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ModifiedFlags/CollectionItemChangingParent/Fixture.cs new file mode 100644 index 00000000..12d25b77 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ModifiedFlags/CollectionItemChangingParent/Fixture.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.ModifiedFlags.CollectionItemChangingParent +{ + using System.Threading.Tasks; + public partial class Fixture : TestBase + { + + [Test] + public async Task ChangeParentReferenceShouldNotThwrowExceptionAsync() + { + using (var tx = Session.BeginTransaction()) + { + var car = await (Session.GetAsync(_carId)).ConfigureAwait(false); + car.Owner = await (Session.GetAsync(_newOwnerId)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ModifiedFlags/MergeColModTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ModifiedFlags/MergeColModTest.cs new file mode 100644 index 00000000..67d1513a --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/ModifiedFlags/MergeColModTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.ModifiedFlags +{ + using System.Threading.Tasks; + public partial class MergeColModTest : TestBase + { + + [Test] + public async Task CheckHistoryAsync() + { + var changedRevisions = await (AuditReader().CreateQuery() + .ForHistoryOf() + .Add(AuditEntity.Property("CaseTags").HasChanged()) + .ResultsAsync()).ConfigureAwait(false); + //rev 2 and rev 4 are the revisions where we remove the tag from the case, thus both revisions should have the casetag property marked as being changed + Assert.IsTrue(changedRevisions.Count(x => x.RevisionEntity.Id == 2 || x.RevisionEntity.Id == 4) == 2); + } + + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/MultiLevelInheritance/InheritanceWithoutInverseTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/MultiLevelInheritance/InheritanceWithoutInverseTest.cs new file mode 100644 index 00000000..52e8f6aa --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/MultiLevelInheritance/InheritanceWithoutInverseTest.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.MultiLevelInheritance +{ + using System.Threading.Tasks; + using System.Threading; + public partial class InheritanceWithoutInverseTest : TestBase + { + + [Test] + public void ShouldNotThrowExceptionOnCreatingAuditAsync() + { + Assert.DoesNotThrowAsync(() => saveParentAsync()); + } + + [Test] + public async Task ShouldAuditParentAndChildProperlyAsync() + { + await (saveParentAsync()).ConfigureAwait(false); + var auditedInheritedParent = await (AuditReader().CreateQuery().ForRevisionsOf().SingleAsync()).ConfigureAwait(false); + var auditedParent = await (AuditReader().CreateQuery().ForRevisionsOf().SingleAsync()).ConfigureAwait(false); + var auditedChild = await (AuditReader().CreateQuery().ForRevisionsOf().SingleAsync()).ConfigureAwait(false); + + Assert.AreEqual(parent.Id, auditedInheritedParent.Id); + Assert.AreEqual(parent.Id, auditedParent.Id); + Assert.AreEqual(parent.Childs.Single().Id, auditedChild.Id); + } + + private async Task saveParentAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + using (var tx = Session.BeginTransaction()) + { + await (Session.SaveAsync(parent, cancellationToken)).ConfigureAwait(false); + await (tx.CommitAsync(cancellationToken)).ConfigureAwait(false); + } + } + } +} diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreExistsInBaseTypeTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreExistsInBaseTypeTest.cs new file mode 100644 index 00000000..dca0007d --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreExistsInBaseTypeTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.NotFoundIgnore.BaseType +{ + using System.Threading.Tasks; + public partial class NotFoundIgnoreExistsInBaseTypeTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Parent), parentId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + + [Test] + public async Task VerifyHistoryAsync() + { + var ver1children = (await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false)).Children; + var ver2children = (await (AuditReader().FindAsync(parentId, 2)).ConfigureAwait(false)).Children; + + ver1children.Single().Sex.Should().Be.EqualTo("Boy"); + ver2children[0].Sex.Should().Be.EqualTo("Boy"); + ver2children[1].Sex.Should().Be.EqualTo("Girl"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreNotExistsInBaseTypeTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreNotExistsInBaseTypeTest.cs new file mode 100644 index 00000000..d540fec8 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreNotExistsInBaseTypeTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.NotFoundIgnore.BaseType +{ + using System.Threading.Tasks; + public partial class NotFoundIgnoreNotExistsInBaseTypeTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(Parent), parentId)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1); + } + + [Test] + public async Task VerifyHistoryAsync() + { + (await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false)).Children + .Single().Name.Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotUpdatable/DetachedTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotUpdatable/DetachedTest.cs new file mode 100644 index 00000000..e846aa4c --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/NotUpdatable/DetachedTest.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Integration.NotUpdatable; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.NotUpdatable +{ + using System.Threading.Tasks; + public partial class DetachedUpdateTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof(PropertyNotUpdatableEntity), id)).ConfigureAwait(false)) + .Should().Have.SameSequenceAs(1, 2); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/OneToMany/UniDirectionalWithBackRefTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/OneToMany/UniDirectionalWithBackRefTest.cs new file mode 100644 index 00000000..0862ed71 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/OneToMany/UniDirectionalWithBackRefTest.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.OneToMany +{ + using System.Threading.Tasks; + public partial class UniDirectionalWithBackRefTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountsAsync() + { + (await (AuditReader().GetRevisionsAsync(typeof (Parent), parentId)).ConfigureAwait(false)).Should().Have.SameSequenceAs(1, 2, 4, 5); + (await (AuditReader().GetRevisionsAsync(typeof(Child), child1Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(2, 3, 5); + (await (AuditReader().GetRevisionsAsync(typeof(Child), child2Id)).ConfigureAwait(false)).Should().Have.SameSequenceAs(4, 5); + } + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + var rev1 = await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false); + var rev2 = await (AuditReader().FindAsync(parentId, 2)).ConfigureAwait(false); + var rev4 = await (AuditReader().FindAsync(parentId, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(parentId, 5)).ConfigureAwait(false); + + rev1.Data.Should().Be.EqualTo(1); + rev1.Children.Should().Be.Empty(); + rev2.Data.Should().Be.EqualTo(1); + rev2.Children.Should().Have.Count.EqualTo(1); + rev4.Data.Should().Be.EqualTo(2); + rev4.Children.Should().Have.Count.EqualTo(2); + rev5.Data.Should().Be.EqualTo(2); + rev5.Children.Should().Be.Empty(); + } + + [Test] + public async Task VerifyHistoryOfChild1Async() + { + var rev2 = await (AuditReader().FindAsync(child1Id, 2)).ConfigureAwait(false); + var rev3 = await (AuditReader().FindAsync(child1Id, 3)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(child1Id, 5)).ConfigureAwait(false); + + rev2.Str.Should().Be.EqualTo("1_1"); + rev3.Str.Should().Be.EqualTo("1_2"); + rev5.Should().Be.Null(); + } + + [Test] + public async Task VerifyHistoryOfChild2Async() + { + var rev4 = await (AuditReader().FindAsync(child2Id, 4)).ConfigureAwait(false); + var rev5 = await (AuditReader().FindAsync(child2Id, 5)).ConfigureAwait(false); + + rev4.Str.Should().Be.EqualTo("1_2"); + rev5.Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/OneToOne/OneToOnePrimaryKeyTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/OneToOne/OneToOnePrimaryKeyTest.cs new file mode 100644 index 00000000..a5494cf7 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/OneToOne/OneToOnePrimaryKeyTest.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.OneToOne +{ + using System.Threading.Tasks; + public partial class OneToOnePrimaryKeyTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1 }, (await (AuditReader().GetRevisionsAsync(typeof(OneToOneOwningEntity), id)).ConfigureAwait(false)).ToList()); + CollectionAssert.AreEquivalent(new[] { 2, 3, 4 }, (await (AuditReader().GetRevisionsAsync(typeof(OneToOneOwnedEntity), id)).ConfigureAwait(false)).ToList()); + } + + [Test] + public async Task VerifyHistoryOfOwningAsync() + { + var owned1 = new OneToOneOwnedEntity{Id=id, Data="1"}; + var owned2 = new OneToOneOwnedEntity{Id=id, Data="2"}; + + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Owned + .Should().Be.Null(); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)).Owned + .Should().Be.EqualTo(owned1); + (await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false)).Owned + .Should().Be.EqualTo(owned2); + (await (AuditReader().FindAsync(id, 4)).ConfigureAwait(false)).Owned + .Should().Be.Null(); + } + + [Test] + public async Task VerifyHistoryOfOwnedAsync() + { + var owning = await (Session.GetAsync(id)).ConfigureAwait(false); + + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)).Should().Be.Null(); + + var ver2 = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + ver2.Data.Should().Be.EqualTo("1"); + ver2.Owning.Should().Be.EqualTo(owning); + + var ver3 = await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false); + ver3.Data.Should().Be.EqualTo("2"); + ver3.Owning.Should().Be.EqualTo(owning); + + (await (AuditReader().FindAsync(id, 4)).ConfigureAwait(false)).Should().Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Performance/EvictAfterTx/EvictAuditDataAfterCommitTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Performance/EvictAfterTx/EvictAuditDataAfterCommitTest.cs new file mode 100644 index 00000000..da3eb4fd --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Performance/EvictAfterTx/EvictAuditDataAfterCommitTest.cs @@ -0,0 +1,101 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Engine; +using NHibernate.Envers.Strategy; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Performance.EvictAfterTx +{ + using System.Threading.Tasks; + public partial class EvictAuditDataAfterCommitTest : TestBase + { + + [Test] + public async Task VerifySessionCacheClearAsync() + { + var auditEntityNames = new[] { "NHibernate.Envers.Tests.Entities.StrTestEntity_AUD" }; + var ste = new StrTestEntity { Str = "data" }; + using (var tx = Session.BeginTransaction()) + { + await (Session.SaveAsync(ste)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + checkEmptyAuditSessionCache(auditEntityNames); + + using (var tx = Session.BeginTransaction()) + { + ste.Str = "changed"; + await (tx.CommitAsync()).ConfigureAwait(false); + } + + checkEmptyAuditSessionCache(auditEntityNames); + } + + [Test] + public async Task VerifySessionCacheCollectionClearAsync() + { + var auditEntityNames = new[] {"NHibernate.Envers.Tests.Entities.OneToMany.SetRefEdEntity_AUD", + "NHibernate.Envers.Tests.Entities.OneToMany.SetRefIngEntity_AUD"}; + + var ed1 = new SetRefEdEntity { Id = 1, Data = "data_ed_1" }; + var ed2 = new SetRefEdEntity { Id = 2, Data = "data_ed_2" }; + var ing1 = new SetRefIngEntity { Id = 3, Data = "data_ing_1" }; + var ing2 = new SetRefIngEntity { Id = 4, Data = "data_ing_2" }; + + using (var tx = Session.BeginTransaction()) + { + await (Session.SaveAsync(ed1)).ConfigureAwait(false); + await (Session.SaveAsync(ed2)).ConfigureAwait(false); + await (Session.SaveAsync(ing1)).ConfigureAwait(false); + await (Session.SaveAsync(ing2)).ConfigureAwait(false); + await (tx.CommitAsync()).ConfigureAwait(false); + } + + checkEmptyAuditSessionCache(auditEntityNames); + + using (var tx = Session.BeginTransaction()) + { + ing1.Reference = ed1; + ing2.Reference = ed1; + await (tx.CommitAsync()).ConfigureAwait(false); + } + + checkEmptyAuditSessionCache(auditEntityNames); + + using (var tx = Session.BeginTransaction()) + { + var reffering = new HashSet { ing1, ing2 }; + ed2.Reffering = reffering; + await (tx.CommitAsync()).ConfigureAwait(false); + } + checkEmptyAuditSessionCache(auditEntityNames); + + using (var tx = Session.BeginTransaction()) + { + ed2.Reffering.Remove(ing1); + await (tx.CommitAsync()).ConfigureAwait(false); + } + checkEmptyAuditSessionCache(auditEntityNames); + + using (var tx = Session.BeginTransaction()) + { + ed2.Reffering.First().Data = "mod_data_ing_2"; + await (tx.CommitAsync()).ConfigureAwait(false); + } + checkEmptyAuditSessionCache(auditEntityNames); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/PersistRevisionInfo/FlushGetCurrentRevisionTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/PersistRevisionInfo/FlushGetCurrentRevisionTest.cs new file mode 100644 index 00000000..7ac4ff66 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/PersistRevisionInfo/FlushGetCurrentRevisionTest.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.PersistRevisionInfo +{ + using System.Threading.Tasks; + public partial class FlushGetCurrentRevisionTest : TestBase + { + + /// + /// When saving many objects, you should flush and clear a session + /// (see "13.1. Batch inserts" in NH reference). This test demonstates + /// an incorrect value of GetCurrentRevision when flushing a session. + /// + /// + [Test] + [TestCase(false)] + [TestCase(true)] + public async Task CompareRevisionIdToAuditedRevisionWithOptionalFlushAsync(bool flushAndClear) + { + int id; + int revisionId; + + var x = new StrTestEntity { Str = "x" }; + using (var tx = Session.BeginTransaction()) + { + id = (int)await (Session.SaveAsync(x)).ConfigureAwait(false); + // Get current revision id (this should be equal to the revision of "x") + revisionId = (await (AuditReader().GetCurrentRevisionAsync(true)).ConfigureAwait(false)).Id; + + if (flushAndClear) + { + // Flush session + await (Session.FlushAsync()).ConfigureAwait(false); + // Clear cache (this seems to cause the problem) + Session.Clear(); + } + + await (tx.CommitAsync()).ConfigureAwait(false); + } + + var revisions = await (AuditReader().GetRevisionsAsync(typeof(StrTestEntity), id)).ConfigureAwait(false); + Assert.That(revisions.Count(), Is.EqualTo(1)); + // If the following assertion fails, the "x" has a different revision + Assert.That(revisions.Last(), Is.EqualTo(revisionId)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/PropertyNull/PrimitiveNullTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/PropertyNull/PrimitiveNullTest.cs new file mode 100644 index 00000000..631720da --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/PropertyNull/PrimitiveNullTest.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.PropertyNull +{ + using System.Threading.Tasks; + public partial class PrimitiveNullTest : TestBase + { + + [Test] + public async Task ShouldBeAbleToFindAuditedEntityAsync() + { + var rev = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + rev.Id.Should().Be.EqualTo(id); + rev.Value.Should().Be.EqualTo(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/BagRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/BagRemovedObjectQueryTest.cs new file mode 100644 index 00000000..d92f2194 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/BagRemovedObjectQueryTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.NetSpecific.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class BagRemovedObjectQueryTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + (await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false)) + .Children.Single().Name.Should().Be.EqualTo("child1"); + (await (AuditReader().FindAsync(parentId, 2)).ConfigureAwait(false)) + .Children.Single().Name.Should().Be.EqualTo("child12"); + var rev3 = await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof(BagParent), true, true) + .Add(AuditEntity.Id().Eq(parentId)) + .Add(AuditEntity.RevisionNumber().Eq(3)) + .GetSingleResultAsync()).ConfigureAwait(false); + rev3.Children.Single().Name.Should().Be.EqualTo("child12"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/ListRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/ListRemovedObjectQueryTest.cs new file mode 100644 index 00000000..50cbc579 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/ListRemovedObjectQueryTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.NetSpecific.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class ListRemovedObjectQueryTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + (await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false)) + .Children.Single().Name.Should().Be.EqualTo("child1"); + (await (AuditReader().FindAsync(parentId, 2)).ConfigureAwait(false)) + .Children.Single().Name.Should().Be.EqualTo("child12"); + var rev3 = await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof(ListParent), true, true) + .Add(AuditEntity.Id().Eq(parentId)) + .Add(AuditEntity.RevisionNumber().Eq(3)) + .GetSingleResultAsync()).ConfigureAwait(false); + rev3.Children.Single().Name.Should().Be.EqualTo("child12"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/MapRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/MapRemovedObjectQueryTest.cs new file mode 100644 index 00000000..4f8974ef --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/MapRemovedObjectQueryTest.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Integration.ManyToMany.Ternary; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class MapRemovedObjectQueryTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + var rev3 = await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof(TernaryMapEntity), true, true) + .Add(AuditEntity.Id().Eq(id)) + .Add(AuditEntity.RevisionNumber().Eq(3)) + .GetSingleResultAsync()).ConfigureAwait(false); + rev3.Map.Keys.Single().Number.Should().Be.EqualTo(2); + rev3.Map.Values.Single().Str.Should().Be.EqualTo("2"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/OneToManyToNotAuditedRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/OneToManyToNotAuditedRemovedObjectQueryTest.cs new file mode 100644 index 00000000..72c9f16e --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/OneToManyToNotAuditedRemovedObjectQueryTest.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Integration.EntityNames.OneToManyNotAudited; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class OneToManyToNotAuditedRemovedObjectQueryTest : TestBase + { + + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + (await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false)).Owners.Should().Be.Empty(); + (await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof (Car), true, true) + .Add(AuditEntity.Id().Eq(parentId)) + .Add(AuditEntity.RevisionNumber().Eq(2)) + .GetSingleResultAsync()).ConfigureAwait(false)) + .Owners.Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/OneToOneRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/OneToOneRemovedObjectQueryTest.cs new file mode 100644 index 00000000..033ee9d8 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/OneToOneRemovedObjectQueryTest.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.NetSpecific.Integration.OneToOne; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class OneToOneRemovedObjectQueryTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfOwningAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Owned.Data.Should().Be.EqualTo("Demo Data 1"); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)) + .Owned.Data.Should().Be.EqualTo("Demo Data 2"); + (await (AuditReader().CreateQuery().ForRevisionsOf(true) + .Add(AuditEntity.Id().Eq(id)) + .Add(AuditEntity.RevisionNumber().Eq(3)) + .ResultsAsync()).ConfigureAwait(false)).First() + .Owned.Data.Should().Be.EqualTo("Demo Data 2"); + } + + [Test] + public async Task VerifyHistoryOfOwnedAsync() + { + (await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false)) + .Owning.Should().Not.Be.Null(); + (await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false)) + .Owning.Should().Not.Be.Null(); + (await (AuditReader().CreateQuery().ForRevisionsOf(true) + .Add(AuditEntity.Id().Eq(id)) + .Add(AuditEntity.RevisionNumber().Eq(3)) + .ResultsAsync()).ConfigureAwait(false)).First() + .Owning.Should().Not.Be.Null(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/StringCollectionRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/StringCollectionRemovedObjectQueryTest.cs new file mode 100644 index 00000000..11703b81 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Proxy/StringCollectionRemovedObjectQueryTest.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using System.Linq; +using NHibernate.Cfg; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities.Collection; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy +{ + using System.Threading.Tasks; + public partial class StringCollectionRemovedObjectQueryTest : TestBase + { + + [Test] + public async Task VerifyHistoryOfParentAsync() + { + (await (AuditReader().FindAsync(parentId, 1)).ConfigureAwait(false)) + .Strings.Should().Be.Empty(); + (await (AuditReader().FindAsync(parentId, 2)).ConfigureAwait(false)) + .Strings.Single().Should().Be.EqualTo("2"); + var rev3 = await (AuditReader().CreateQuery().ForRevisionsOfEntity(typeof(StringSetEntity), true, true) + .Add(AuditEntity.Id().Eq(parentId)) + .Add(AuditEntity.RevisionNumber().Eq(3)) + .GetSingleResultAsync()).ConfigureAwait(false); + rev3.Strings.Single().Should().Be.EqualTo("2"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/ComponentQueryTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/ComponentQueryTest.cs new file mode 100644 index 00000000..7a7d96b1 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/ComponentQueryTest.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Query; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Query +{ + using System.Threading.Tasks; + public partial class ComponentQueryTest : TestBase + { + + [Test] + public async Task CanQueryComponentProperty_UsingDotAsync() + { + (await (Session.Auditer().CreateQuery() + .ForRevisionsOf() + .Add(AuditEntity.Property("Weight.Kilo").Eq(personWeight)) + .ResultsAsync()).ConfigureAwait(false)) + .Should().Have.Count.EqualTo(1); + } + + [Test] + public async Task CanQueryComponentProperty_UsingUnderscoreAsync() + { + (await (Session.Auditer().CreateQuery() + .ForRevisionsOf() + .Add(AuditEntity.Property("Weight_Kilo").Eq(personWeight)) + .ResultsAsync()).ConfigureAwait(false)) + .Should().Have.Count.EqualTo(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/ComponentInTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/ComponentInTest.cs new file mode 100644 index 00000000..045d8dc6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/ComponentInTest.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Query.RelationIn +{ + using System.Threading.Tasks; + public partial class ComponentInTest : TestBase + { + + [Test] + public async Task ShouldGiveHitAsync() + { + var searchedInts = new []{3, 75, 125}; + (await (Session.Auditer().CreateQuery().ForEntitiesAtRevision(1) + .Add(AuditEntity.Property("Weight.Kilo").In(searchedInts)) + .ResultsAsync()).ConfigureAwait(false)).Should().Not.Be.Empty(); + } + + [Test] + public async Task ShouldNotGiveHitAsync() + { + var searchedInts = new[] { 3, 85, 125 }; + (await (Session.Auditer().CreateQuery().ForEntitiesAtRevision(1) + .Add(AuditEntity.Property("Weight.Kilo").In(searchedInts)) + .ResultsAsync()).ConfigureAwait(false)).Should().Be.Empty(); + } + + [Test] + public async Task ShouldWorkUsingObjectArrayDirectlyAsync() + { + var searchedInts = new object[] { 75 }; + (await (Session.Auditer().CreateQuery().ForEntitiesAtRevision(1) + .Add(AuditEntity.Property("Weight.Kilo").In(searchedInts)) + .ResultsAsync()).ConfigureAwait(false)).Should().Not.Be.Empty(); + } + + [Test] + public async Task ShouldAcceptEmptyAsync() + { + (await (Session.Auditer().CreateQuery().ForEntitiesAtRevision(1) + .Add(AuditEntity.Property("Weight.Kilo").In(new List())) + .ResultsAsync()).ConfigureAwait(false)).Should().Be.Empty(); + + (await (Session.Auditer().CreateQuery().ForEntitiesAtRevision(1) + .Add(AuditEntity.Property("Weight.Kilo").In(new object[0])) + .ResultsAsync()).ConfigureAwait(false)).Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/RelationEmbInTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/RelationEmbInTest.cs new file mode 100644 index 00000000..819a0091 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/RelationEmbInTest.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities.Ids; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Query.RelationIn +{ + using System.Threading.Tasks; + public partial class RelationEmbInTest : TestBase + { + + [Test] + public async Task ShouldFindAsync() + { + (await (AuditReader().CreateQuery().ForRevisionsOf() + .Add(AuditEntity.Property("Data").Eq("data")) + .Add(AuditEntity.Property("Reference").In(new List { embEntNoRef1, embEnt, embEntNoRef2 })) + .ResultsAsync()).ConfigureAwait(false)).Should().Have.SameSequenceAs(new[]{ent}); + } + + [Test] + public async Task ShouldMissAsync() + { + (await (AuditReader().CreateQuery().ForRevisionsOf() + .Add(AuditEntity.Property("Data").Eq("data")) + .Add(AuditEntity.Property("Reference").In(new List { embEntNoRef1, embEntNoRef2 })) + .ResultsAsync()).ConfigureAwait(false)).Should().Be.Empty(); + } + + [Test] + public async Task ShouldMissDueToOtherProoertyAsync() + { + (await (AuditReader().CreateQuery().ForRevisionsOf() + .Add(AuditEntity.Property("Reference").In(new List { embEnt })) + .Add(AuditEntity.Property("Data").Eq("not data")) + .ResultsAsync()).ConfigureAwait(false)).Should().Be.Empty(); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/RelationInTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/RelationInTest.cs new file mode 100644 index 00000000..908f91e6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Query/RelationIn/RelationInTest.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tests.Entities.OneToMany; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Query.RelationIn +{ + using System.Threading.Tasks; + public partial class RelationInTest : TestBase + { + + [Test] + public async Task ShouldBeAbleToUseInOnSingleSideAsync() + { + (await (AuditReader().CreateQuery().ForRevisionsOf() + .Add(AuditEntity.Property("Reference").In(new List { ed , edNotReferenced })) + .Add(AuditEntity.Property("Data").Eq("bar")) + .ResultsAsync()).ConfigureAwait(false)).Should().Contain(ing); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/ChangeListenerInstanceTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/ChangeListenerInstanceTest.cs new file mode 100644 index 00000000..c47f2c8f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/ChangeListenerInstanceTest.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Configuration.Attributes; +using NHibernate.Envers.Configuration.Store; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.RevInfo +{ + using System.Threading.Tasks; + public partial class ChangeListenerInstanceTest : TestBase + { + + [Test] + public async Task EntityShouldHaveBeenPersistedAsync() + { + (await (Session.CreateQuery("select count(s) from StrTestEntity s where s.Str='x'").UniqueResultAsync()).ConfigureAwait(false)) + .Should().Be.EqualTo(1); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/Time/DateTimeTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/Time/DateTimeTest.cs new file mode 100644 index 00000000..e10c227f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/Time/DateTimeTest.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.RevInfo.Time +{ + using System.Threading.Tasks; + public partial class DateTimeTest : TestBase + { + + [Test] + public async Task ShouldUseUtcDateForRevisionDateAsync() + { + var utcNow = DateTime.UtcNow; + var res = (await (AuditReader().CreateQuery().ForHistoryOf().ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.RevisionDate.Should().Be.IncludedIn(utcNow.AddMinutes(-1), utcNow.AddMinutes(1)); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/Time/LongTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/Time/LongTest.cs new file mode 100644 index 00000000..a18b3573 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/RevInfo/Time/LongTest.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Envers.Tests.Entities.RevEntity; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.RevInfo.Time +{ + using System.Threading.Tasks; + public partial class LongTest : TestBase + { + + [Test] + public async Task ShouldUseUtcDateForRevisionDateAsync() + { + var utcNow = DateTime.UtcNow; + var res = (await (AuditReader().CreateQuery().ForHistoryOf().ResultsAsync()).ConfigureAwait(false)).First(); + res.RevisionEntity.CustomTimestamp.Should().Be.IncludedIn(utcNow.AddMinutes(-1).Ticks, utcNow.AddMinutes(1).Ticks); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/SortedSetAndMap/SortedSetAndMapTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/SortedSetAndMap/SortedSetAndMapTest.cs new file mode 100644 index 00000000..fa54ed6f --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/SortedSetAndMap/SortedSetAndMapTest.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Tests.Entities; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.SortedSetAndMap +{ + using System.Threading.Tasks; + public partial class SortedSetAndMapTest : TestBase + { + + [Test] + public async Task VerifyRevisionCountAsync() + { + CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, await (AuditReader().GetRevisionsAsync(typeof(SortedSetEntity), id)).ConfigureAwait(false)); + } + + [Test] + public async Task VerifyHistory1Async() + { + var rev = await (AuditReader().FindAsync(id, 1)).ConfigureAwait(false); + + CollectionAssert.IsEmpty(rev.SortedSet); + CollectionAssert.IsEmpty(rev.SortedMap); + } + + [Test] + public async Task VerifyHistory2Async() + { + var rev = await (AuditReader().FindAsync(id, 2)).ConfigureAwait(false); + + rev.SortedSet.Count + .Should().Be.EqualTo(2); + rev.SortedSet.First().Str + .Should().Be.EqualTo("b"); + rev.SortedSet.Last().Str + .Should().Be.EqualTo("a"); + + CollectionAssert.IsEmpty(rev.SortedMap); + } + + [Test] + public async Task VerifyHistory3Async() + { + var rev = await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false); + + rev.SortedSet.Count + .Should().Be.EqualTo(1); + rev.SortedSet.First().Str + .Should().Be.EqualTo("a"); + + rev.SortedMap.Count + .Should().Be.EqualTo(2); + rev.SortedMap.Keys.First().Str + .Should().Be.EqualTo("b"); + rev.SortedMap.Keys.Last().Str + .Should().Be.EqualTo("a"); + } + + [Test] + public async Task SortedSetShouldStillHaveCorrectComparerAsync() + { + var newObj = new StrTestEntity {Str = "c"}; + var rev = await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false); + + rev.SortedSet.Count + .Should().Be.GreaterThan(0); + + rev.SortedSet.Add(newObj); + + rev.SortedSet.First() + .Should().Be.SameInstanceAs(newObj); + } + + [Test] + public async Task SortedMapShouldStillHaveCorrectComparerAsync() + { + var newObj = new StrTestEntity { Str = "c" }; + var rev = await (AuditReader().FindAsync(id, 3)).ConfigureAwait(false); + + rev.SortedMap.Count + .Should().Be.GreaterThan(0); + + + rev.SortedMap.Add(newObj, "dd"); + + rev.SortedMap.Keys.First() + .Should().Be.SameInstanceAs(newObj); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Strategy/SetOfValues/SetOfValuesTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Strategy/SetOfValues/SetOfValuesTest.cs new file mode 100644 index 00000000..db0ff3ac --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Strategy/SetOfValues/SetOfValuesTest.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NUnit.Framework; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Strategy.SetOfValues +{ + using System.Threading.Tasks; + public partial class SetOfValuesTest : ValidityTestBase + { + + [Test] + public async Task SameValueCanBeAddedToAndThenRemovedFromTheColectionMoreThanOnceAsync() + { + // Remove value that has been removed and then added back before + using (var tx = Session.BeginTransaction()) + { + var c = await (Session.GetAsync(id)).ConfigureAwait(false); + c.ChildValues.Remove("v"); + await (tx.CommitAsync()).ConfigureAwait(false); + } + Assert.Pass("Value successfuly removed"); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Transaction/RollbackAuditExceptionTest.cs b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Transaction/RollbackAuditExceptionTest.cs new file mode 100644 index 00000000..473294a6 --- /dev/null +++ b/Src/NHibernate.Envers.Tests/Async/NetSpecific/Integration/Transaction/RollbackAuditExceptionTest.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Tests.Entities; +using NHibernate.Exceptions; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Envers.Tests.NetSpecific.Integration.Transaction +{ + using System.Threading.Tasks; + using System.Threading; + public partial class RollbackAuditExceptionTest : TestBase + { + + [Test] + public async Task WhenAuditPersistExceptionOccursTransactionShouldBeRolledBackAsync() + { + int intId; + var willCrash = new NoSchemaEntity(); + var intEntity = new IntTestEntity(); + + using (var tx = Session.BeginTransaction()) + { + intId = (int)await (Session.SaveAsync(intEntity)).ConfigureAwait(false); + await (Session.SaveAsync(willCrash)).ConfigureAwait(false); + Assert.ThrowsAsync(() => tx.CommitAsync()); + } + ForceNewSession(); + await (verifyNoDataGotPeristedAsync(intId)).ConfigureAwait(false); + } + + [Test] + public async Task WhenAuditPersistExceptionOccursTransactionShouldBeRolledBack_FlushModeNeverAsync() + { + int intId; + var willCrash = new NoSchemaEntity(); + var intEntity = new IntTestEntity(); + Session.FlushMode = FlushMode.Manual; + + using (Session.BeginTransaction()) + { + intId = (int)await (Session.SaveAsync(intEntity)).ConfigureAwait(false); + await (Session.SaveAsync(willCrash)).ConfigureAwait(false); + Assert.ThrowsAsync(() => Session.FlushAsync()); + } + await (verifyNoDataGotPeristedAsync(intId)).ConfigureAwait(false); + } + + private async Task verifyNoDataGotPeristedAsync(int id, CancellationToken cancellationToken = default(CancellationToken)) + { + using(Session.BeginTransaction()) + { + (await (Session.CreateQuery("select count(s) from StrTestEntity s ").UniqueResultAsync(cancellationToken)).ConfigureAwait(false)) + .Should().Be.EqualTo(0); + (await (Session.CreateQuery("select count(s) from IntTestEntity s ").UniqueResultAsync(cancellationToken)).ConfigureAwait(false)) + .Should().Be.EqualTo(0); + (await (Session.Auditer().GetRevisionsAsync(typeof(IntTestEntity),id, cancellationToken)).ConfigureAwait(false)) + .Should().Be.Empty(); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers.Tests/DatabaseSetup.cs b/Src/NHibernate.Envers.Tests/DatabaseSetup.cs index 8f4803ed..7865892b 100644 --- a/Src/NHibernate.Envers.Tests/DatabaseSetup.cs +++ b/Src/NHibernate.Envers.Tests/DatabaseSetup.cs @@ -12,7 +12,7 @@ public class DatabaseSetup private static readonly IDictionary> setupMethods = new Dictionary> { {"NHibernate.Driver.SqlClientDriver", setupSqlServer}, - {"NHibernate.Driver.MySqlDataDriver", setupMySql}, + {"NHibernate.Driver.MySqlConnector.MySqlConnectorDriver, NHibernate.Driver.MySqlConnector", setupMySql}, {"NHibernate.Driver.FirebirdClientDriver", setupFirebird}, {"NHibernate.Driver.NpgsqlDriver", setupNpgsql}, {"NHibernate.Driver.OracleManagedDataClientDriver", setupOracle} diff --git a/Src/NHibernate.Envers.Tests/Integration/AccessType/FieldAccessTest.cs b/Src/NHibernate.Envers.Tests/Integration/AccessType/FieldAccessTest.cs index 4e98e210..b0941d4c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/AccessType/FieldAccessTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/AccessType/FieldAccessTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.AccessType { - public class FieldAccessTest : TestBase + public partial class FieldAccessTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/AccessType/ImmutableClassAccessTest.cs b/Src/NHibernate.Envers.Tests/Integration/AccessType/ImmutableClassAccessTest.cs index 7dc0d7d8..5efb2a1d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/AccessType/ImmutableClassAccessTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/AccessType/ImmutableClassAccessTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.AccessType { - public class ImmutableClassAccessTest : TestBase + public partial class ImmutableClassAccessTest : TestBase { private Country country; diff --git a/Src/NHibernate.Envers.Tests/Integration/AccessType/MixedAccessTest.cs b/Src/NHibernate.Envers.Tests/Integration/AccessType/MixedAccessTest.cs index 1de1c158..b31d52c9 100644 --- a/Src/NHibernate.Envers.Tests/Integration/AccessType/MixedAccessTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/AccessType/MixedAccessTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.AccessType { - public class MixedAccessTest : TestBase + public partial class MixedAccessTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/AccessType/NoSetterTest.cs b/Src/NHibernate.Envers.Tests/Integration/AccessType/NoSetterTest.cs index 027b92fd..3ddda4f6 100644 --- a/Src/NHibernate.Envers.Tests/Integration/AccessType/NoSetterTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/AccessType/NoSetterTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.AccessType { - public class NoSetterTest : TestBase + public partial class NoSetterTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/AccessType/PropertyAccessTest.cs b/Src/NHibernate.Envers.Tests/Integration/AccessType/PropertyAccessTest.cs index 7d691b62..b11e87ae 100644 --- a/Src/NHibernate.Envers.Tests/Integration/AccessType/PropertyAccessTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/AccessType/PropertyAccessTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.AccessType { - public class PropertyAccessTest : TestBase + public partial class PropertyAccessTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/AuditReader/AuditReaderAPITest.cs b/Src/NHibernate.Envers.Tests/Integration/AuditReader/AuditReaderAPITest.cs index bf7e1280..dcf2fe6a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/AuditReader/AuditReaderAPITest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/AuditReader/AuditReaderAPITest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.AuditReader { - public class AuditReaderAPITest : TestBase + public partial class AuditReaderAPITest : TestBase { public AuditReaderAPITest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/ColumnScalePrecisionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/ColumnScalePrecisionTest.cs index 7cda10b3..4b1f914e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/ColumnScalePrecisionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/ColumnScalePrecisionTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class ColumnScalePrecisionTest : TestBase + public partial class ColumnScalePrecisionTest : TestBase { private long id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/DeleteTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/DeleteTest.cs index 1f525d6c..92f784bd 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/DeleteTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/DeleteTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class DeleteTest : TestBase + public partial class DeleteTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/EmptyStringTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/EmptyStringTest.cs index db2ade56..5999d7c8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/EmptyStringTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/EmptyStringTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class EmptyStringTest : TestBase + public partial class EmptyStringTest : TestBase { private int emptyId; private int nullId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/GlobalVersionedTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/GlobalVersionedTest.cs index 56696f4e..0107984d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/GlobalVersionedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/GlobalVersionedTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class GlobalVersionedTest : TestBase + public partial class GlobalVersionedTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/ManyOperationsInTransactionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/ManyOperationsInTransactionTest.cs index f0e4ab6e..3cfe9c81 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/ManyOperationsInTransactionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/ManyOperationsInTransactionTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class ManyOperationsInTransactionTest : TestBase + public partial class ManyOperationsInTransactionTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/NullPropertiesTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/NullPropertiesTest.cs index 96721fb4..1cfa5dc8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/NullPropertiesTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/NullPropertiesTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class NullPropertiesTest : TestBase + public partial class NullPropertiesTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/OutsideTransactionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/OutsideTransactionTest.cs index a3da787d..c6b624f4 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/OutsideTransactionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/OutsideTransactionTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class OutsideTransactionTest : TestBase + public partial class OutsideTransactionTest : TestBase { public OutsideTransactionTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/SimpleTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/SimpleTest.cs index 61e123be..8de40a2d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/SimpleTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/SimpleTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class SimpleTest : TestBase + public partial class SimpleTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/SingleOperationInTransactionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/SingleOperationInTransactionTest.cs index e7ea1eb3..4285aca4 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/SingleOperationInTransactionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/SingleOperationInTransactionTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class SingleOperationInTransactionTest : TestBase + public partial class SingleOperationInTransactionTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/TransactionRollbackBehaviourTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/TransactionRollbackBehaviourTest.cs index c18b29a3..8da5a1db 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/TransactionRollbackBehaviourTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/TransactionRollbackBehaviourTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class TransactionRollbackBehaviourTest : TestBase + public partial class TransactionRollbackBehaviourTest : TestBase { private int rollbackId; private int committedId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/UnversionedPropertiesChangeTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/UnversionedPropertiesChangeTest.cs index d17c8ba7..65d3e9c7 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/UnversionedPropertiesChangeTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/UnversionedPropertiesChangeTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class UnversionedPropertiesChangeTest : TestBase + public partial class UnversionedPropertiesChangeTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Basic/UnversionedPropertyTest.cs b/Src/NHibernate.Envers.Tests/Integration/Basic/UnversionedPropertyTest.cs index 1fad4c47..09946b62 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Basic/UnversionedPropertyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Basic/UnversionedPropertyTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Basic { - public class UnversionedPropertyTest : TestBase + public partial class UnversionedPropertyTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Cache/OneToManyCacheTest.cs b/Src/NHibernate.Envers.Tests/Integration/Cache/OneToManyCacheTest.cs index 3f7ce929..3733ce63 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Cache/OneToManyCacheTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Cache/OneToManyCacheTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Cache { - public class OneToManyCacheTest : TestBase + public partial class OneToManyCacheTest : TestBase { private int ed1_id; private int ing1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Cache/OneToOneCacheTest.cs b/Src/NHibernate.Envers.Tests/Integration/Cache/OneToOneCacheTest.cs index 65c850f2..cf014f5c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Cache/OneToOneCacheTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Cache/OneToOneCacheTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Cache { - public class OneToOneCacheTest : TestBase + public partial class OneToOneCacheTest : TestBase { private int ed1_id; private int ing1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Cache/QueryCacheTest.cs b/Src/NHibernate.Envers.Tests/Integration/Cache/QueryCacheTest.cs index f103637b..2bc7fef2 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Cache/QueryCacheTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Cache/QueryCacheTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Cache { - public class QueryCacheTest : TestBase + public partial class QueryCacheTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/BasicEmbeddableCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/BasicEmbeddableCollectionTest.cs index 22e36498..645caef0 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/BasicEmbeddableCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/BasicEmbeddableCollectionTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable { - public class BasicEmbeddableCollectionTest : TestBase + public partial class BasicEmbeddableCollectionTest : TestBase { private const int id = 11; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableList1Test.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableList1Test.cs index 0d45a87e..4e5e7e10 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableList1Test.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableList1Test.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable { - public class EmbeddableList1Test : TestBase + public partial class EmbeddableList1Test : TestBase { private int ele1Id; private Component4 c4_1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableList2Test.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableList2Test.cs index 9170bc6d..d5888c3c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableList2Test.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableList2Test.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable { - public class EmbeddableList2Test : TestBase + public partial class EmbeddableList2Test : TestBase { private int eleId1; private StrTestNoProxyEntity entity1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableMapTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableMapTest.cs index 771ca3e6..2455b9c8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableMapTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableMapTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable { - public class EmbeddableMapTest : TestBase + public partial class EmbeddableMapTest : TestBase { private int eme1Id; private int eme2Id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableSetTest.cs index a7bdfde4..68539a1a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/Embeddable/EmbeddableSetTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection.Embeddable { - public class EmbeddableSetTest : TestBase + public partial class EmbeddableSetTest : TestBase { private int ese1Id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/EnumSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/EnumSetTest.cs index 22f6280f..4998ba8e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/EnumSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/EnumSetTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection { - public class EnumSetTest : TestBase + public partial class EnumSetTest : TestBase { private int sse1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/MapKey/ComponentMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/MapKey/ComponentMapKeyTest.cs index 0999c5bd..1032f2c6 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/MapKey/ComponentMapKeyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/MapKey/ComponentMapKeyTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection.MapKey { - public class ComponentMapKeyTest : TestBase + public partial class ComponentMapKeyTest : TestBase { private int cmke_id; private int cte1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/MapKey/IdMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/MapKey/IdMapKeyTest.cs index 02815879..6e1c8a50 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/MapKey/IdMapKeyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/MapKey/IdMapKeyTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection.MapKey { - public class IdMapKeyTest : TestBase + public partial class IdMapKeyTest : TestBase { private int imke_id; private int ste1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/NoRevision/AbstractCollectionChangeTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/NoRevision/AbstractCollectionChangeTest.cs index 3ef0cf8e..eed8d69e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/NoRevision/AbstractCollectionChangeTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/NoRevision/AbstractCollectionChangeTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection.NoRevision { - public abstract class AbstractCollectionChangeTest : TestBase + public abstract partial class AbstractCollectionChangeTest : TestBase { protected AbstractCollectionChangeTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/StringListTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/StringListTest.cs index 98d7d7cc..5c2f4e0b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/StringListTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/StringListTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection { - public class StringListTest : TestBase + public partial class StringListTest : TestBase { private int sle1_id; private int sle2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/StringMapTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/StringMapTest.cs index 4bf99333..b1c26c7b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/StringMapTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/StringMapTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection { - public class StringMapTest : TestBase + public partial class StringMapTest : TestBase { private int sme1_id; private int sme2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Collection/StringSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/Collection/StringSetTest.cs index 81fb04c8..c8e8cb31 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Collection/StringSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Collection/StringSetTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Collection { - public class StringSetTest : TestBase + public partial class StringSetTest : TestBase { private int sse1_id; private int sse2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Components/Collections/CollectionOfComponentsTest.cs b/Src/NHibernate.Envers.Tests/Integration/Components/Collections/CollectionOfComponentsTest.cs index aa9da079..5c1be983 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Components/Collections/CollectionOfComponentsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Components/Collections/CollectionOfComponentsTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Components.Collections { - public class CollectionOfComponentsTest : TestBase + public partial class CollectionOfComponentsTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Components/ComponentsTest.cs b/Src/NHibernate.Envers.Tests/Integration/Components/ComponentsTest.cs index efe61d11..a88ebdf6 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Components/ComponentsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Components/ComponentsTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Components { - public class ComponentsTest : TestBase + public partial class ComponentsTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Components/DefaultValueComponentsTest.cs b/Src/NHibernate.Envers.Tests/Integration/Components/DefaultValueComponentsTest.cs index bc1b538d..d266b7e1 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Components/DefaultValueComponentsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Components/DefaultValueComponentsTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Components { - public class DefaultValueComponentsTest : TestBase + public partial class DefaultValueComponentsTest : TestBase { private int id0; private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Components/PropertiesGroupTest.cs b/Src/NHibernate.Envers.Tests/Integration/Components/PropertiesGroupTest.cs index 6b445d69..912bb03b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Components/PropertiesGroupTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Components/PropertiesGroupTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Components { - public class PropertiesGroupTest : TestBase + public partial class PropertiesGroupTest : TestBase { private long auditedId; private long notAuditedId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Components/Relations/ManyToOneInComponentTest.cs b/Src/NHibernate.Envers.Tests/Integration/Components/Relations/ManyToOneInComponentTest.cs index e1d99f8f..5a693604 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Components/Relations/ManyToOneInComponentTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Components/Relations/ManyToOneInComponentTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Components.Relations { - public class ManyToOneInComponentTest : TestBase + public partial class ManyToOneInComponentTest : TestBase { private int mtocte_id1; private int ste_id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Components/Relations/NotAuditedManyToOneInComponentTest.cs b/Src/NHibernate.Envers.Tests/Integration/Components/Relations/NotAuditedManyToOneInComponentTest.cs index 46f7da1d..86215933 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Components/Relations/NotAuditedManyToOneInComponentTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Components/Relations/NotAuditedManyToOneInComponentTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Components.Relations { - public class NotAuditedManyToOneInComponentTest : TestBase + public partial class NotAuditedManyToOneInComponentTest : TestBase { private int mtocte_id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Components/Relations/OneToManyInComponentTest.cs b/Src/NHibernate.Envers.Tests/Integration/Components/Relations/OneToManyInComponentTest.cs index 708075a6..abdb59a0 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Components/Relations/OneToManyInComponentTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Components/Relations/OneToManyInComponentTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Components.Relations { - public class OneToManyInComponentTest : TestBase + public partial class OneToManyInComponentTest : TestBase { private int otmcte_id1; private int ste_id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/CustomType/CompositeCustomTest.cs b/Src/NHibernate.Envers.Tests/Integration/CustomType/CompositeCustomTest.cs index e69f6764..1b9dc73a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/CustomType/CompositeCustomTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/CustomType/CompositeCustomTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.CustomType { - public class CompositeCustomTest : TestBase + public partial class CompositeCustomTest : TestBase { private int ccte_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/CustomType/ParametrizedCustomTest.cs b/Src/NHibernate.Envers.Tests/Integration/CustomType/ParametrizedCustomTest.cs index 28ad3c92..e4160099 100644 --- a/Src/NHibernate.Envers.Tests/Integration/CustomType/ParametrizedCustomTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/CustomType/ParametrizedCustomTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.CustomType { - public class ParametrizedCustomTest : TestBase + public partial class ParametrizedCustomTest : TestBase { private int pcte_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/CustomType/PrimitiveCustomTest.cs b/Src/NHibernate.Envers.Tests/Integration/CustomType/PrimitiveCustomTest.cs index 9bde23f8..5c09a4f5 100644 --- a/Src/NHibernate.Envers.Tests/Integration/CustomType/PrimitiveCustomTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/CustomType/PrimitiveCustomTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.CustomType { - public class PrimitiveCustomTest : TestBase + public partial class PrimitiveCustomTest : TestBase { private int pctec_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Data/DateTest.cs b/Src/NHibernate.Envers.Tests/Integration/Data/DateTest.cs index d306f7c9..ed562a4a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Data/DateTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Data/DateTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Data { - public class DateTest : TestBase + public partial class DateTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Data/EnumTest.cs b/Src/NHibernate.Envers.Tests/Integration/Data/EnumTest.cs index fa7764e9..b097c05f 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Data/EnumTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Data/EnumTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Data { - public class EnumTest : TestBase + public partial class EnumTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Data/LobsTest.cs b/Src/NHibernate.Envers.Tests/Integration/Data/LobsTest.cs index 0d34ac68..3ada9622 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Data/LobsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Data/LobsTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Data { - public class LobsTest : TestBase + public partial class LobsTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Data/SerializableTest.cs b/Src/NHibernate.Envers.Tests/Integration/Data/SerializableTest.cs index 7646c44e..4cdd2da0 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Data/SerializableTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Data/SerializableTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Data { - public class SerializableTest : TestBase + public partial class SerializableTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/EntityNames/AuditedEntity/ReadEntityWithEntityNameTest.cs b/Src/NHibernate.Envers.Tests/Integration/EntityNames/AuditedEntity/ReadEntityWithEntityNameTest.cs index 5ec941da..cd0c171f 100644 --- a/Src/NHibernate.Envers.Tests/Integration/EntityNames/AuditedEntity/ReadEntityWithEntityNameTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/EntityNames/AuditedEntity/ReadEntityWithEntityNameTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.EntityNames.AuditedEntity { - public class ReadEntityWithEntityNameTest : TestBase + public partial class ReadEntityWithEntityNameTest : TestBase { private long id_pers1; private long id_pers2; diff --git a/Src/NHibernate.Envers.Tests/Integration/EntityNames/ManyToManyAudited/ReadEntityWithAuditedManyToManyTest.cs b/Src/NHibernate.Envers.Tests/Integration/EntityNames/ManyToManyAudited/ReadEntityWithAuditedManyToManyTest.cs index a8b38476..1201f5b3 100644 --- a/Src/NHibernate.Envers.Tests/Integration/EntityNames/ManyToManyAudited/ReadEntityWithAuditedManyToManyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/EntityNames/ManyToManyAudited/ReadEntityWithAuditedManyToManyTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.EntityNames.ManyToManyAudited { - public class ReadEntityWithAuditedManyToManyTest : TestBase + public partial class ReadEntityWithAuditedManyToManyTest : TestBase { private long id_car1; private long id_car2; diff --git a/Src/NHibernate.Envers.Tests/Integration/EntityNames/OneToManyAudited/ReadEntityWithAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/EntityNames/OneToManyAudited/ReadEntityWithAuditedCollectionTest.cs index 18c41e8f..1bf5685f 100644 --- a/Src/NHibernate.Envers.Tests/Integration/EntityNames/OneToManyAudited/ReadEntityWithAuditedCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/EntityNames/OneToManyAudited/ReadEntityWithAuditedCollectionTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.EntityNames.OneToManyAudited { - public class ReadEntityWithAuditedCollectionTest : TestBase + public partial class ReadEntityWithAuditedCollectionTest : TestBase { private long id_car1; private long id_car2; diff --git a/Src/NHibernate.Envers.Tests/Integration/EntityNames/OneToManyNotAudited/ReadEntityWithAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/EntityNames/OneToManyNotAudited/ReadEntityWithAuditedCollectionTest.cs index 71bd57b7..2cbe3152 100644 --- a/Src/NHibernate.Envers.Tests/Integration/EntityNames/OneToManyNotAudited/ReadEntityWithAuditedCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/EntityNames/OneToManyNotAudited/ReadEntityWithAuditedCollectionTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.EntityNames.OneToManyNotAudited { - public class ReadEntityWithAuditedCollectionTest : TestBase + public partial class ReadEntityWithAuditedCollectionTest : TestBase { private long id_car1; private long id_car2; diff --git a/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedAudited/ReadEntityAssociatedAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedAudited/ReadEntityAssociatedAuditedTest.cs index b8202686..bea498b8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedAudited/ReadEntityAssociatedAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedAudited/ReadEntityAssociatedAuditedTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.EntityNames.SingleAssociatedAudited { - public class ReadEntityAssociatedAuditedTest : TestBase + public partial class ReadEntityAssociatedAuditedTest : TestBase { private long id_car1; private long id_car2; diff --git a/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedAudited/SingleDomainObjectToMultipleTablesTest.cs b/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedAudited/SingleDomainObjectToMultipleTablesTest.cs index e1945b84..fd0d8fb9 100644 --- a/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedAudited/SingleDomainObjectToMultipleTablesTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedAudited/SingleDomainObjectToMultipleTablesTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.EntityNames.SingleAssociatedAudited { - public class SingleDomainObjectToMultipleTablesTest : TestBase + public partial class SingleDomainObjectToMultipleTablesTest : TestBase { private long carId; private long ownerId; diff --git a/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedNotAudited/ReadEntityAssociatedNotAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedNotAudited/ReadEntityAssociatedNotAuditedTest.cs index e885fef8..cce296fe 100644 --- a/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedNotAudited/ReadEntityAssociatedNotAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/EntityNames/SingleAssociatedNotAudited/ReadEntityAssociatedNotAuditedTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.EntityNames.SingleAssociatedNotAudited { - public class ReadEntityAssociatedNotAuditedTest : TestBase + public partial class ReadEntityAssociatedNotAuditedTest : TestBase { private long id_car1; private long id_car2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushAddDelTest.cs b/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushAddDelTest.cs index 256327f1..0b90ad36 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushAddDelTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushAddDelTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Flush { - public class DoubleFlushAddDelTest : TestBase + public partial class DoubleFlushAddDelTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushAddModTest.cs b/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushAddModTest.cs index edb5be48..a288d7d7 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushAddModTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushAddModTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Flush { - public class DoubleFlushAddModTest :TestBase + public partial class DoubleFlushAddModTest :TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushModDelTest.cs b/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushModDelTest.cs index 09ff23f8..e425dc32 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushModDelTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushModDelTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Flush { - public class DoubleFlushModDelTest :TestBase + public partial class DoubleFlushModDelTest :TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushModModTest.cs b/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushModModTest.cs index eaaa6452..a44d1437 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushModModTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Flush/DoubleFlushModModTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Flush { - public class DoubleFlushModModTest :TestBase + public partial class DoubleFlushModModTest :TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Flush/ManualFlushTest.cs b/Src/NHibernate.Envers.Tests/Integration/Flush/ManualFlushTest.cs index cabf7622..c4ca6c46 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Flush/ManualFlushTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Flush/ManualFlushTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Flush { - public class ManualFlushTest :TestBase + public partial class ManualFlushTest :TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Generated/GeneratedColumnTest.cs b/Src/NHibernate.Envers.Tests/Integration/Generated/GeneratedColumnTest.cs index c6a5d74a..cc188627 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Generated/GeneratedColumnTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Generated/GeneratedColumnTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Generated { - public class GeneratedColumnTest : TestBase + public partial class GeneratedColumnTest : TestBase { private int entityId; diff --git a/Src/NHibernate.Envers.Tests/Integration/HashCode/ChangingHashcodeTest.cs b/Src/NHibernate.Envers.Tests/Integration/HashCode/ChangingHashcodeTest.cs index 41ff2a5e..a63d07a8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/HashCode/ChangingHashcodeTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/HashCode/ChangingHashcodeTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.HashCode { - public class ChangingHashcodeTest : TestBase + public partial class ChangingHashcodeTest : TestBase { private int pageId; private int imageId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Ids/CompositeDateIdTest.cs b/Src/NHibernate.Envers.Tests/Integration/Ids/CompositeDateIdTest.cs index ba568d31..c38c6805 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Ids/CompositeDateIdTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Ids/CompositeDateIdTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Ids { - public class CompositeDateIdTest : TestBase + public partial class CompositeDateIdTest : TestBase { private DateEmbId id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Ids/CompositeIdTest.cs b/Src/NHibernate.Envers.Tests/Integration/Ids/CompositeIdTest.cs index 0cd6b351..b8d77806 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Ids/CompositeIdTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Ids/CompositeIdTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Ids { - public class CompositeIdTest : TestBase + public partial class CompositeIdTest : TestBase { private EmbId id1; private EmbId id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Ids/DateIdTest.cs b/Src/NHibernate.Envers.Tests/Integration/Ids/DateIdTest.cs index d2183710..fe722c6c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Ids/DateIdTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Ids/DateIdTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Ids { - public class DateIdTest : TestBase + public partial class DateIdTest : TestBase { private DateTime id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Ids/EmbeddedId/RelationInsideEmbeddableTest.cs b/Src/NHibernate.Envers.Tests/Integration/Ids/EmbeddedId/RelationInsideEmbeddableTest.cs index b9aabdfb..9810e2c2 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Ids/EmbeddedId/RelationInsideEmbeddableTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Ids/EmbeddedId/RelationInsideEmbeddableTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Ids.EmbeddedId { - public class RelationInsideEmbeddableTest : TestBase + public partial class RelationInsideEmbeddableTest : TestBase { private int orderId; private ItemId itemId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildAuditingTest.cs index e683e314..49ececd0 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildAuditingTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined { - public class ChildAuditingTest : TestBase + public partial class ChildAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildNullAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildNullAuditingTest.cs index e8917f5f..e54a3a0f 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildNullAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildNullAuditingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined { - public class ChildNullAuditingTest : TestBase + public partial class ChildNullAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildRelation/ChildReferencingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildRelation/ChildReferencingTest.cs index 7f523f4d..537b5882 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildRelation/ChildReferencingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ChildRelation/ChildReferencingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.ChildRelation { - public class ChildReferencingTest : TestBase + public partial class ChildReferencingTest : TestBase { private int re_id1; private int re_id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/EmptyChild/EmptyChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/EmptyChild/EmptyChildAuditingTest.cs index cf20d136..8ae271b7 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/EmptyChild/EmptyChildAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/EmptyChild/EmptyChildAuditingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.EmptyChild { - public class EmptyChildAuditingTest : TestBase + public partial class EmptyChildAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/NotOwnedRelation/NotOwnBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/NotOwnedRelation/NotOwnBidirectionalTest.cs index 485fbbb4..3b7cdf28 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/NotOwnedRelation/NotOwnBidirectionalTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/NotOwnedRelation/NotOwnBidirectionalTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.NotOwnedRelation { - public class NotOwnBidirectionalTest : TestBase + public partial class NotOwnBidirectionalTest : TestBase { private long pc_id; private long a1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ParentAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ParentAuditingTest.cs index 8a30c259..0552d2f6 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ParentAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/ParentAuditingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined { - public class ParentAuditingTest : TestBase + public partial class ParentAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/PrimaryKeyJoin/ChildPrimaryKeyJoinAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/PrimaryKeyJoin/ChildPrimaryKeyJoinAuditingTest.cs index 77cffd4d..2daac32a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/PrimaryKeyJoin/ChildPrimaryKeyJoinAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/PrimaryKeyJoin/ChildPrimaryKeyJoinAuditingTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.PrimaryKeyJoin { [Audited] - public class ChildPrimaryKeyJoinAuditingTest : TestBase + public partial class ChildPrimaryKeyJoinAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/ParentReferencingChildTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/ParentReferencingChildTest.cs index 612db58a..154091ef 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/ParentReferencingChildTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/ParentReferencingChildTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.Relation { - public class ParentReferencingChildTest : TestBase + public partial class ParentReferencingChildTest : TestBase { private Person expLukaszRev1; private Person expLukaszRev2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/PolymorphicCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/PolymorphicCollectionTest.cs index 89dc5fec..6a59f250 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/PolymorphicCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/PolymorphicCollectionTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.Relation { - public class PolymorphicCollectionTest : TestBase + public partial class PolymorphicCollectionTest : TestBase { private int ed_id1; private int c_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/Unidirectional/UnidirectionalDoubleAbstractTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/Unidirectional/UnidirectionalDoubleAbstractTest.cs index 86bc0f5c..d75cd02f 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/Unidirectional/UnidirectionalDoubleAbstractTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Joined/Relation/Unidirectional/UnidirectionalDoubleAbstractTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Joined.Relation.Unidirectional { - public class UnidirectionalDoubleAbstractTest : TestBase + public partial class UnidirectionalDoubleAbstractTest : TestBase { private long cce1_id; private int cse1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Mixed/MixedInheritanceStrategiesEntityTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Mixed/MixedInheritanceStrategiesEntityTest.cs index 2e96a582..4f3b387d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Mixed/MixedInheritanceStrategiesEntityTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Mixed/MixedInheritanceStrategiesEntityTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Mixed { - public class MixedInheritanceStrategiesEntityTest : TestBase + public partial class MixedInheritanceStrategiesEntityTest : TestBase { private ActivityId id1; private ActivityId id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ChildAuditingTest.cs index 975634d3..89e26aec 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ChildAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ChildAuditingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Single { - public class ChildAuditingTest : TestBase + public partial class ChildAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ChildRelation/ChildReferencingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ChildRelation/ChildReferencingTest.cs index d29ffa1e..fd7f33c2 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ChildRelation/ChildReferencingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ChildRelation/ChildReferencingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Single.ChildRelation { - public class ChildReferencingTest : TestBase + public partial class ChildReferencingTest : TestBase { private int re_id1; private int re_id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/DiscriminatorFormula/DiscriminatorFormulaTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/DiscriminatorFormula/DiscriminatorFormulaTest.cs index b73ff872..1788a8d5 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/DiscriminatorFormula/DiscriminatorFormulaTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/DiscriminatorFormula/DiscriminatorFormulaTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Single.DiscriminatorFormula { - public class DiscriminatorFormulaTest : TestBase + public partial class DiscriminatorFormulaTest : TestBase { private PersistentClass parentAudit; private ChildEntity childVer1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/NotOwnedRelation/NotOwnBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/NotOwnedRelation/NotOwnBidirectionalTest.cs index bb36c020..c89b002a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/NotOwnedRelation/NotOwnBidirectionalTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/NotOwnedRelation/NotOwnBidirectionalTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Single.NotOwnedRelation { - public class NotOwnBidirectionalTest : TestBase + public partial class NotOwnBidirectionalTest : TestBase { private long pc_id; private long a1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ParentAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ParentAuditingTest.cs index 63982208..a93f96ab 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ParentAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/ParentAuditingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Single { - public class ParentAuditingTest : TestBase + public partial class ParentAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/Relation/PolymorphicCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/Relation/PolymorphicCollectionTest.cs index 02f61530..840390f6 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/Relation/PolymorphicCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/Single/Relation/PolymorphicCollectionTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.Single.Relation { - public class PolymorphicCollectionTest : TestBase + public partial class PolymorphicCollectionTest : TestBase { private int ed_id1; private int c_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ChildAuditingTest.cs index babd2f97..cd0ae653 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ChildAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ChildAuditingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass { - public class ChildAuditingTest : TestBase + public partial class ChildAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ChildRelation/ChildReferencingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ChildRelation/ChildReferencingTest.cs index 230113c7..98b86e67 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ChildRelation/ChildReferencingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ChildRelation/ChildReferencingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass.ChildRelation { - public class ChildReferencingTest : TestBase + public partial class ChildReferencingTest : TestBase { private int re_id1; private int re_id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/NotOwnedRelation/NotOwnBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/NotOwnedRelation/NotOwnBidirectionalTest.cs index 533e6c29..bb3d21a5 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/NotOwnedRelation/NotOwnBidirectionalTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/NotOwnedRelation/NotOwnBidirectionalTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass.NotOwnedRelation { - public class NotOwnBidirectionalTest : TestBase + public partial class NotOwnBidirectionalTest : TestBase { private long pc_id; private long a1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ParentAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ParentAuditingTest.cs index 6b33c08c..3845af98 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ParentAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/ParentAuditingTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass { - public class ParentAuditingTest : TestBase + public partial class ParentAuditingTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/Relation/PolymorphicCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/Relation/PolymorphicCollectionTest.cs index d9a3db25..c824238e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/Relation/PolymorphicCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Inheritance/TablePerClass/Relation/PolymorphicCollectionTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Inheritance.TablePerClass.Relation { - public class PolymorphicCollectionTest : TestBase + public partial class PolymorphicCollectionTest : TestBase { private int ed_id1; private int c_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Components/InterfacesComponentsTest.cs b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Components/InterfacesComponentsTest.cs index c337bc35..02ee5c95 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Components/InterfacesComponentsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Components/InterfacesComponentsTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Interfaces.Components { - public class InterfacesComponentsTest : TestBase + public partial class InterfacesComponentsTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/AllAudited/AbstractAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/AllAudited/AbstractAllAuditedTest.cs index 14e9c505..80afb77b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/AllAudited/AbstractAllAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/AllAudited/AbstractAllAuditedTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Interfaces.Inheritance.AllAudited { - public abstract class AbstractAllAuditedTest : TestBase + public abstract partial class AbstractAllAuditedTest : TestBase { private long aiId; private long naiId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/PropertiesAudited/AbstractAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/PropertiesAudited/AbstractAllAuditedTest.cs index c9549209..23e6b236 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/PropertiesAudited/AbstractAllAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/PropertiesAudited/AbstractAllAuditedTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Interfaces.Inheritance.PropertiesAudited { - public abstract class AbstractAllAuditedTest : TestBase + public abstract partial class AbstractAllAuditedTest : TestBase { private long aiId; private long naiId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/PropertiesAudited2/AbstractAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/PropertiesAudited2/AbstractAllAuditedTest.cs index d7dfe87f..1ed9f96c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/PropertiesAudited2/AbstractAllAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Inheritance/PropertiesAudited2/AbstractAllAuditedTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Interfaces.Inheritance.PropertiesAudited2 { - public abstract class AbstractAllAuditedTest : TestBase + public abstract partial class AbstractAllAuditedTest : TestBase { private long aiId; private long naiId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Relation/InterfacesRelationTest.cs b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Relation/InterfacesRelationTest.cs index 96422e66..cc37de35 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Interfaces/Relation/InterfacesRelationTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Interfaces/Relation/InterfacesRelationTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Interfaces.Relation { - public class InterfacesRelationTest : TestBase + public partial class InterfacesRelationTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Join/BasicJoinTest.cs b/Src/NHibernate.Envers.Tests/Integration/Join/BasicJoinTest.cs index eabc461a..33ddb18a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Join/BasicJoinTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Join/BasicJoinTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Join { - public class BasicJoinTest : TestBase + public partial class BasicJoinTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Join/NamingJoinTest.cs b/Src/NHibernate.Envers.Tests/Integration/Join/NamingJoinTest.cs index bab94fa2..9c40f725 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Join/NamingJoinTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Join/NamingJoinTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Join { - public class NamingJoinTest : TestBase + public partial class NamingJoinTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicListTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicListTest.cs index 3bec2a80..158a3450 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicListTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicListTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany { //rk - using bag instead of list. Birefs lists aren't supported in NH Core (?) //and also... AFAIK - even Hibernate tests actually use bags. - public class BasicListTest : TestBase + public partial class BasicListTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicMapTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicMapTest.cs index 29a68042..3b0b6ac5 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicMapTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicMapTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany { - public class BasicMapTest : TestBase + public partial class BasicMapTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicSetTest.cs index c37b3a7d..534590dc 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicSetTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany { - public class BasicSetTest : TestBase + public partial class BasicSetTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicWhereJoinTableTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicWhereJoinTableTest.cs index 2e4ef3bb..bc140284 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicWhereJoinTableTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BasicWhereJoinTableTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany { - public class BasicWhereJoinTableTest : TestBase + public partial class BasicWhereJoinTableTest : TestBase { private int ite1_1_id; private int ite1_2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BiOwned/BasicBiOwnedTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BiOwned/BasicBiOwnedTest.cs index 354d0a5b..fd02b6cb 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BiOwned/BasicBiOwnedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/BiOwned/BasicBiOwnedTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.BiOwned { - public class BasicBiOwnedTest : TestBase + public partial class BasicBiOwnedTest : TestBase { private int o1_1_id; private int o1_2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/InverseToSuperclass/ManyToManyInverseToSuperclassTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/InverseToSuperclass/ManyToManyInverseToSuperclassTest.cs index e16ba027..ba2d913a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/InverseToSuperclass/ManyToManyInverseToSuperclassTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/InverseToSuperclass/ManyToManyInverseToSuperclassTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.InverseToSuperclass { - public class ManyToManyInverseToSuperclassTest : TestBase + public partial class ManyToManyInverseToSuperclassTest : TestBase { private long masterId; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/SameTable/BasicSameTableTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/SameTable/BasicSameTableTest.cs index 9648d1db..572728f0 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/SameTable/BasicSameTableTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/SameTable/BasicSameTableTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.SameTable { - public class BasicSameTableTest : TestBase + public partial class BasicSameTableTest : TestBase { private int p1_id; private int p2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/Ternary/TernaryMapFlushTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/Ternary/TernaryMapFlushTest.cs index e42a516b..ac55ea34 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/Ternary/TernaryMapFlushTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/Ternary/TernaryMapFlushTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.Ternary { - public class TernaryMapFlushTest : TestBase + public partial class TernaryMapFlushTest : TestBase { private int str1_id; private int str2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/Ternary/TernaryMapTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/Ternary/TernaryMapTest.cs index c81cbcbe..b19208a8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/Ternary/TernaryMapTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/Ternary/TernaryMapTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.Ternary { - public class TernaryMapTest : TestBase + public partial class TernaryMapTest : TestBase { private int str1_id; private int str2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniListTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniListTest.cs index 76feb182..6daf6bfb 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniListTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniListTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional { - public class BasicUniListTest : TestBase + public partial class BasicUniListTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniMapTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniMapTest.cs index 303483f2..04959ee1 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniMapTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniMapTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional { - public class BasicUniMapTest : TestBase + public partial class BasicUniMapTest : TestBase { private int str1_id; private int str2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniSetTest.cs index b748b48a..f27cfe74 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/BasicUniSetTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional { - public class BasicUniSetTest : TestBase + public partial class BasicUniSetTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/M2MIndexedListNotAuditedTargetTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/M2MIndexedListNotAuditedTargetTest.cs index 20c568cc..c37b0892 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/M2MIndexedListNotAuditedTargetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/M2MIndexedListNotAuditedTargetTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional { - public class M2MIndexedListNotAuditedTargetTest :TestBase + public partial class M2MIndexedListNotAuditedTargetTest :TestBase { private UnversionedStrTestEntity uste1; private UnversionedStrTestEntity uste2; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/M2MRelationNotAuditedTargetTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/M2MRelationNotAuditedTargetTest.cs index 620f37fc..bf21a7f2 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/M2MRelationNotAuditedTargetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToMany/UniDirectional/M2MRelationNotAuditedTargetTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToMany.UniDirectional { - public class M2MRelationNotAuditedTargetTest : TestBase + public partial class M2MRelationNotAuditedTargetTest : TestBase { private int tnae1_id; private int tnae2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToOne/BiDirectional/ImplicitMappedByTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToOne/BiDirectional/ImplicitMappedByTest.cs index eec0115f..d59f179b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToOne/BiDirectional/ImplicitMappedByTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToOne/BiDirectional/ImplicitMappedByTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToOne.BiDirectional { - public class ImplicitMappedByTest : TestBase + public partial class ImplicitMappedByTest : TestBase { private long ownedId; private long owning1Id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ManyToOne/UniDirectional/RelationNotAuditedTargetTest.cs b/Src/NHibernate.Envers.Tests/Integration/ManyToOne/UniDirectional/RelationNotAuditedTargetTest.cs index 1febe293..0745bcb8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ManyToOne/UniDirectional/RelationNotAuditedTargetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ManyToOne/UniDirectional/RelationNotAuditedTargetTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ManyToOne.UniDirectional { - public class RelationNotAuditedTargetTest : TestBase + public partial class RelationNotAuditedTargetTest : TestBase { private int tnae1_id; private int tnae2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Merge/AddDelTest.cs b/Src/NHibernate.Envers.Tests/Integration/Merge/AddDelTest.cs index 366623ae..8e7eae37 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Merge/AddDelTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Merge/AddDelTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Merge { - public class AddDelTest : TestBase + public partial class AddDelTest : TestBase { private const int id = 17; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/AbstractModifiedFlagsEntityTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/AbstractModifiedFlagsEntityTest.cs index 90f1c219..5d01808c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/AbstractModifiedFlagsEntityTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/AbstractModifiedFlagsEntityTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public abstract class AbstractModifiedFlagsEntityTest : TestBase + public abstract partial class AbstractModifiedFlagsEntityTest : TestBase { protected AbstractModifiedFlagsEntityTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAPITest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAPITest.cs index 1d53bda5..a0f8d500 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAPITest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAPITest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedAPITest : AbstractModifiedFlagsEntityTest + public partial class HasChangedAPITest : AbstractModifiedFlagsEntityTest { public HasChangedAPITest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAuditedManyToManyRemovalTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAuditedManyToManyRemovalTest.cs index 1cd2b2dc..d367a94a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAuditedManyToManyRemovalTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAuditedManyToManyRemovalTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedAuditedManyToManyRemovalTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedAuditedManyToManyRemovalTest : AbstractModifiedFlagsEntityTest { private int professorId; private int studentId; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAuditedManyToManyTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAuditedManyToManyTest.cs index 68923f7f..a37b39f1 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAuditedManyToManyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedAuditedManyToManyTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedAuditedManyToManyTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedAuditedManyToManyTest : AbstractModifiedFlagsEntityTest { private long idCar1; private long idPers1; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedBidirectional2Test.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedBidirectional2Test.cs index f42362c3..c5872b4d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedBidirectional2Test.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedBidirectional2Test.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedBidirectional2Test : AbstractModifiedFlagsEntityTest + public partial class HasChangedBidirectional2Test : AbstractModifiedFlagsEntityTest { private int ed1Id; private int ed2Id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedChildAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedChildAuditingTest.cs index f80818e8..f6681acf 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedChildAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedChildAuditingTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedChildAuditingTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedChildAuditingTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedChildReferencingTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedChildReferencingTest.cs index 5748b16c..59630d9e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedChildReferencingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedChildReferencingTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedChildReferencingTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedChildReferencingTest : AbstractModifiedFlagsEntityTest { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentCollectionTest.cs index 34aa6c89..3318017d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentCollectionTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedComponentCollectionTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedComponentCollectionTest : AbstractModifiedFlagsEntityTest { private int ele1Id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentMapKeyTest.cs index 3d9eccc8..8f5b9031 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentMapKeyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentMapKeyTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedComponentMapKeyTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedComponentMapKeyTest : AbstractModifiedFlagsEntityTest { private int cmke_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentsTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentsTest.cs index 97f572ec..9fbee976 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedComponentsTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedComponentsTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedComponentsTest : AbstractModifiedFlagsEntityTest { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedCompositeCustomTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedCompositeCustomTest.cs index 218de5e6..5da5001b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedCompositeCustomTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedCompositeCustomTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedCompositeCustomTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedCompositeCustomTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedDoubleJoinColumnBidirectionalListTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedDoubleJoinColumnBidirectionalListTest.cs index d26769cb..c0c2002d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedDoubleJoinColumnBidirectionalListTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedDoubleJoinColumnBidirectionalListTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedDoubleJoinColumnBidirectionalListTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedDoubleJoinColumnBidirectionalListTest : AbstractModifiedFlagsEntityTest { private int ed1_1_id; private int ed2_1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedEnumSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedEnumSetTest.cs index 043ba61a..7ae2a55d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedEnumSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedEnumSetTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedEnumSetTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedEnumSetTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedForDefaultNotUsingTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedForDefaultNotUsingTest.cs index f80a77dc..25fcac4a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedForDefaultNotUsingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedForDefaultNotUsingTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedForDefaultNotUsingTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedForDefaultNotUsingTest : AbstractModifiedFlagsEntityTest { private const int entityId = 37; private const int refEntityId = 133; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedIdMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedIdMapKeyTest.cs index 96d8518f..afede596 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedIdMapKeyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedIdMapKeyTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedIdMapKeyTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedIdMapKeyTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedInsertUpdateSameTransactionTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedInsertUpdateSameTransactionTest.cs index 33b676b3..6dd88ca4 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedInsertUpdateSameTransactionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedInsertUpdateSameTransactionTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedInsertUpdateSameTransactionTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedInsertUpdateSameTransactionTest : AbstractModifiedFlagsEntityTest { public HasChangedInsertUpdateSameTransactionTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedManualFlushTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedManualFlushTest.cs index e79d8b63..fec4235c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedManualFlushTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedManualFlushTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedManualFlushTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedManualFlushTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedManyToOneInComponentTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedManyToOneInComponentTest.cs index 35957175..350a49ed 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedManyToOneInComponentTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedManyToOneInComponentTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedManyToOneInComponentTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedManyToOneInComponentTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedMergeTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedMergeTest.cs index 4a908ddf..34731166 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedMergeTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedMergeTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedMergeTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedMergeTest : AbstractModifiedFlagsEntityTest { private const int parentId = 11; private const int childId = 12; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedNotOwnedBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedNotOwnedBidirectionalTest.cs index 16e100b1..cf841e1e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedNotOwnedBidirectionalTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedNotOwnedBidirectionalTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedNotOwnedBidirectionalTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedNotOwnedBidirectionalTest : AbstractModifiedFlagsEntityTest { private long pc_id; private long a1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedNullPropertiesTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedNullPropertiesTest.cs index 94112043..05bab103 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedNullPropertiesTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedNullPropertiesTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedNullPropertiesTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedNullPropertiesTest : AbstractModifiedFlagsEntityTest { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedOneToManyInComponentTEst.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedOneToManyInComponentTEst.cs index 6012cdbe..0a0f5be7 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedOneToManyInComponentTEst.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedOneToManyInComponentTEst.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedOneToManyInComponentTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedOneToManyInComponentTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedStringMapTEst.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedStringMapTEst.cs index 6612174e..bb8c7000 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedStringMapTEst.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedStringMapTEst.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedStringMapTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedStringMapTest : AbstractModifiedFlagsEntityTest { private int sme1_id; private int sme2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedStringSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedStringSetTest.cs index abf33dee..64282b0d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedStringSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedStringSetTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedStringSetTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedStringSetTest : AbstractModifiedFlagsEntityTest { private int sse1_id; private int sse2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedUnversionedPropertiesTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedUnversionedPropertiesTest.cs index a192a299..28796f57 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedUnversionedPropertiesTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/HasChangedUnversionedPropertiesTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class HasChangedUnversionedPropertiesTest : AbstractModifiedFlagsEntityTest + public partial class HasChangedUnversionedPropertiesTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/ModifiedFlagSuffixTest.cs b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/ModifiedFlagSuffixTest.cs index a7283783..e6714415 100644 --- a/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/ModifiedFlagSuffixTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/ModifiedFlags/ModifiedFlagSuffixTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.ModifiedFlags { - public class ModifiedFlagSuffixTest : AbstractModifiedFlagsEntityTest + public partial class ModifiedFlagSuffixTest : AbstractModifiedFlagsEntityTest { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/MultipleRelations/MultipleAssociationsTest .cs b/Src/NHibernate.Envers.Tests/Integration/MultipleRelations/MultipleAssociationsTest .cs index 7af2b2b5..3edbf581 100644 --- a/Src/NHibernate.Envers.Tests/Integration/MultipleRelations/MultipleAssociationsTest .cs +++ b/Src/NHibernate.Envers.Tests/Integration/MultipleRelations/MultipleAssociationsTest .cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.MultipleRelations { - public class MultipleAssociationsTest : TestBase + public partial class MultipleAssociationsTest : TestBase { private long lukaszId; private long kingaId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Naming/BasicNamingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Naming/BasicNamingTest.cs index f7c7dbf2..94f8fd51 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Naming/BasicNamingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Naming/BasicNamingTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Naming { - public class BasicNamingTest : TestBase + public partial class BasicNamingTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Naming/EstonianTableAliasTest.cs b/Src/NHibernate.Envers.Tests/Integration/Naming/EstonianTableAliasTest.cs index 1b83602c..7e651b64 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Naming/EstonianTableAliasTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Naming/EstonianTableAliasTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Naming { - public class EstonianTableAliasTest : TestBase + public partial class EstonianTableAliasTest : TestBase { private long parentId; private long childId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Naming/Ids/JoinEmbIdNamingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Naming/Ids/JoinEmbIdNamingTest.cs index 7fabb1c9..c95c8321 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Naming/Ids/JoinEmbIdNamingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Naming/Ids/JoinEmbIdNamingTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Naming.Ids { - public class JoinEmbIdNamingTest : TestBase + public partial class JoinEmbIdNamingTest : TestBase { private EmbIdNaming ed_id1; private EmbIdNaming ed_id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Naming/JoinNamingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Naming/JoinNamingTest.cs index f4f5cd86..d9d93e28 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Naming/JoinNamingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Naming/JoinNamingTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Naming { - public class JoinNamingTest : TestBase + public partial class JoinNamingTest : TestBase { private int ed_id1; private int ed_id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Naming/OneToManyUniDirectionalNamingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Naming/OneToManyUniDirectionalNamingTest.cs index ad58c021..3dcd0dfc 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Naming/OneToManyUniDirectionalNamingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Naming/OneToManyUniDirectionalNamingTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Naming { - public class OneToManyUniDirectionalNamingTest : TestBase + public partial class OneToManyUniDirectionalNamingTest : TestBase { private int uni1_id; private int str1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Naming/Quotation/QuotedFieldsTest.cs b/Src/NHibernate.Envers.Tests/Integration/Naming/Quotation/QuotedFieldsTest.cs index fbf8abce..a0289291 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Naming/Quotation/QuotedFieldsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Naming/Quotation/QuotedFieldsTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Naming.Quotation { - public class QuotedFieldsTest : TestBase + public partial class QuotedFieldsTest : TestBase { private long qfeId1; private long qfeId2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Naming/VersionsJoinTableNamingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Naming/VersionsJoinTableNamingTest.cs index f44d148d..24bf9b7d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Naming/VersionsJoinTableNamingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Naming/VersionsJoinTableNamingTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Naming { - public class VersionsJoinTableNamingTest : TestBase + public partial class VersionsJoinTableNamingTest : TestBase { private int uni1_id; private int str1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Naming/VersionsJoinTableRangeComponentNamingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Naming/VersionsJoinTableRangeComponentNamingTest.cs index 9289f949..33f4593a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Naming/VersionsJoinTableRangeComponentNamingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Naming/VersionsJoinTableRangeComponentNamingTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Naming { - public class VersionsJoinTableRangeComponentNamingTest : TestBase + public partial class VersionsJoinTableRangeComponentNamingTest : TestBase { private int vjrcte_id; private int vjtrte_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/NotInsertable/ManyToOne/ManyToOneNotInsertableTest.cs b/Src/NHibernate.Envers.Tests/Integration/NotInsertable/ManyToOne/ManyToOneNotInsertableTest.cs index 474843bb..2feb12a5 100644 --- a/Src/NHibernate.Envers.Tests/Integration/NotInsertable/ManyToOne/ManyToOneNotInsertableTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/NotInsertable/ManyToOne/ManyToOneNotInsertableTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.NotInsertable.ManyToOne { - public class ManyToOneNotInsertableTest : TestBase + public partial class ManyToOneNotInsertableTest : TestBase { private int mto_id1; private int type_id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/NotInsertable/NotInsertableTest.cs b/Src/NHibernate.Envers.Tests/Integration/NotInsertable/NotInsertableTest.cs index 9c15683d..14e3105a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/NotInsertable/NotInsertableTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/NotInsertable/NotInsertableTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.NotInsertable { - public class NotInsertableTest : TestBase + public partial class NotInsertableTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/NotUpdatable/PropertyNotUpdatableTest.cs b/Src/NHibernate.Envers.Tests/Integration/NotUpdatable/PropertyNotUpdatableTest.cs index d93551c9..a1e6df17 100644 --- a/Src/NHibernate.Envers.Tests/Integration/NotUpdatable/PropertyNotUpdatableTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/NotUpdatable/PropertyNotUpdatableTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.NotUpdatable { - public class PropertyNotUpdatableTest : TestBase + public partial class PropertyNotUpdatableTest : TestBase { private long id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicCollectionTest.cs index 00193bc4..7a563f7f 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicCollectionTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany { - public class BasicCollectionTest : TestBase + public partial class BasicCollectionTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetTest.cs index b7482929..005e91b8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany { - public class BasicSetTest : TestBase + public partial class BasicSetTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetWithEmbIdTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetWithEmbIdTest.cs index d2112b2d..340bda25 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetWithEmbIdTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetWithEmbIdTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany { - public class BasicSetWithEmbIdTest : TestBase + public partial class BasicSetWithEmbIdTest : TestBase { private EmbId ed1_id; private EmbId ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetWithNullsDeleteTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetWithNullsDeleteTest.cs index 171cc2bc..bad62bc3 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetWithNullsDeleteTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BasicSetWithNullsDeleteTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany { - public class BasicSetWithNullsDeleteTest : TestBase + public partial class BasicSetWithNullsDeleteTest : TestBase { private const int ed1_id =123; private const int ed2_id =54; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BidirectionalMapKeyTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BidirectionalMapKeyTest.cs index 5f8efd2c..c7c40b41 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/BidirectionalMapKeyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/BidirectionalMapKeyTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany { //rk - mapkeyattribute should (hopefully) go away! - public class BidirectionalMapKeyTest : TestBase + public partial class BidirectionalMapKeyTest : TestBase { private int ed_id; private int ing1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedListTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedListTest.cs index 9e9a34f2..a6b06b01 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedListTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedListTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class BasicDetachedListTest : TestBase + public partial class BasicDetachedListTest : TestBase { private int str1_id; private int str2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedSetTest.cs index 437a5505..6e00100e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedSetTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class BasicDetachedSetTest : TestBase + public partial class BasicDetachedSetTest : TestBase { private int str1_id; private int str2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedSetWithEmbIdTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedSetWithEmbIdTest.cs index 1e6826df..f465a60b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedSetWithEmbIdTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/BasicDetachedSetWithEmbIdTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class BasicDetachedSetWithEmbIdTest : TestBase + public partial class BasicDetachedSetWithEmbIdTest : TestBase { private EmbId str1_id; private EmbId str2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DataChangesDetachedSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DataChangesDetachedSetTest.cs index 6d528e5c..d22f74b5 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DataChangesDetachedSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DataChangesDetachedSetTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class DataChangesDetachedSetTest : TestBase + public partial class DataChangesDetachedSetTest : TestBase { private int str1_id; private int coll1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DetachedTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DetachedTest.cs index 48b195cb..ee1e6376 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DetachedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DetachedTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class DetachedTest : TestBase + public partial class DetachedTest : TestBase { private const int parentId = 132; private int childId; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DoubleDetachedSetTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DoubleDetachedSetTest.cs index 3d8fdbb2..cd5e96e4 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DoubleDetachedSetTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DoubleDetachedSetTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class DoubleDetachedSetTest : TestBase + public partial class DoubleDetachedSetTest : TestBase { private int str1_id; private int str2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DoubleJoinColumnBidirectionalListTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DoubleJoinColumnBidirectionalListTest.cs index 79783707..62982e0f 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DoubleJoinColumnBidirectionalListTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/DoubleJoinColumnBidirectionalListTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class DoubleJoinColumnBidirectionalListTest : TestBase + public partial class DoubleJoinColumnBidirectionalListTest : TestBase { private int ed1_1_id; private int ed2_1_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/IndexedJoinColumnBidirectionalListTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/IndexedJoinColumnBidirectionalListTest.cs index 84e74149..455baf77 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/IndexedJoinColumnBidirectionalListTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/IndexedJoinColumnBidirectionalListTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class IndexedJoinColumnBidirectionalListTest : TestBase + public partial class IndexedJoinColumnBidirectionalListTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/JoinColumnBidirectionalListTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/JoinColumnBidirectionalListTest.cs index ded3868e..1042a3c8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/JoinColumnBidirectionalListTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/JoinColumnBidirectionalListTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class JoinColumnBidirectionalListTest :TestBase + public partial class JoinColumnBidirectionalListTest :TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/JoinColumnBidirectionalListWithInheritanceTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/JoinColumnBidirectionalListWithInheritanceTest.cs index e75532c4..a2480a07 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/JoinColumnBidirectionalListWithInheritanceTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/Detached/JoinColumnBidirectionalListWithInheritanceTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.Detached { - public class JoinColumnBidirectionalListWithInheritanceTest : TestBase + public partial class JoinColumnBidirectionalListWithInheritanceTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/EmbeddedId/MapsIdTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/EmbeddedId/MapsIdTest.cs index d4aa1ad6..44e9ff67 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/EmbeddedId/MapsIdTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/EmbeddedId/MapsIdTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.EmbeddedId { - public class MapsIdTest : TestBase + public partial class MapsIdTest : TestBase { private PersonTuple tuple1Ver1; private PersonTuple tuple2Ver1; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/InverseSideChangesTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/InverseSideChangesTest.cs index bce67436..c2b1cd36 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/InverseSideChangesTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/InverseSideChangesTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany { - public class InverseSideChangesTest : TestBase + public partial class InverseSideChangesTest : TestBase { private const int ed1_id =123123; private const int ing1_id = 33; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToMany/InverseToSuperclass/OneToManyInverseToSuperclassTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToMany/InverseToSuperclass/OneToManyInverseToSuperclassTest.cs index 6e721236..a9bd1a9a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToMany/InverseToSuperclass/OneToManyInverseToSuperclassTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToMany/InverseToSuperclass/OneToManyInverseToSuperclassTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToMany.InverseToSuperclass { - public class OneToManyInverseToSuperclassTest : TestBase + public partial class OneToManyInverseToSuperclassTest : TestBase { private long masterId; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/Bidirectional2Test.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/Bidirectional2Test.cs index ec393141..49e861de 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/Bidirectional2Test.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/Bidirectional2Test.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional { - public class Bidirectional2Test : TestBase + public partial class Bidirectional2Test : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalEagerHbmTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalEagerHbmTest.cs index 60325cdd..d6264a8c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalEagerHbmTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalEagerHbmTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional { - public class BidirectionalEagerHbmTest : TestBase + public partial class BidirectionalEagerHbmTest : TestBase { private long refIngId1; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalNoNullsTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalNoNullsTest.cs index 960a1fcf..a5f06430 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalNoNullsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalNoNullsTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional { - public class BidirectionalNoNullsTest : TestBase + public partial class BidirectionalNoNullsTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalSaveTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalSaveTest.cs index 40b3491e..8988f19b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalSaveTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalSaveTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional { - public class BidirectionalSaveTest : TestBase + public partial class BidirectionalSaveTest : TestBase { private const int id = 18; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalTest.cs index 0da5e461..eb2e8a7e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/BidirectionalTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional { - public class BidirectionalTest : TestBase + public partial class BidirectionalTest : TestBase { private int ed1_id; private int ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/Ids/EmbIdBidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/Ids/EmbIdBidirectionalTest.cs index d819927b..3f0183e2 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/Ids/EmbIdBidirectionalTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/Ids/EmbIdBidirectionalTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional.Ids { - public class EmbIdBidirectionalTest : TestBase + public partial class EmbIdBidirectionalTest : TestBase { private EmbId ed1_id; private EmbId ed2_id; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/PrimaryKeyJoinColumn/OneToOneWithPrimaryKeyJoinTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/PrimaryKeyJoinColumn/OneToOneWithPrimaryKeyJoinTest.cs index e17879f6..a696f982 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/PrimaryKeyJoinColumn/OneToOneWithPrimaryKeyJoinTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/BiDirectional/PrimaryKeyJoinColumn/OneToOneWithPrimaryKeyJoinTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.BiDirectional.PrimaryKeyJoinColumn { - public class OneToOneWithPrimaryKeyJoinTest : TestBase + public partial class OneToOneWithPrimaryKeyJoinTest : TestBase { private long personId; private long accountId; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UniDirectionalWithNullsTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UniDirectionalWithNullsTest.cs index e0cde499..d5d16f09 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UniDirectionalWithNullsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UniDirectionalWithNullsTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.UniDirectional { //change this port a bit. added a unique index - public class UniDirectionalWithNullsTest : TestBase + public partial class UniDirectionalWithNullsTest : TestBase { private const int ed1_id = 1; private const int ed2_id = 2; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UnidirectionalMulIdWithNullsTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UnidirectionalMulIdWithNullsTest.cs index 7563ecde..cf41003c 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UnidirectionalMulIdWithNullsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UnidirectionalMulIdWithNullsTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.UniDirectional { - public class UnidirectionalMulIdWithNullsTest : TestBase + public partial class UnidirectionalMulIdWithNullsTest : TestBase { private EmbId ei; diff --git a/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UnidirectionalTest.cs b/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UnidirectionalTest.cs index 60fa5dea..858fd791 100644 --- a/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UnidirectionalTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/OneToOne/UniDirectional/UnidirectionalTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.OneToOne.UniDirectional { - public class UnidirectionalTest : TestBase + public partial class UnidirectionalTest : TestBase { private const int ed1_id = 1; private const int ed2_id = 2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Primitive/PrimitiveAddDeleteTest.cs b/Src/NHibernate.Envers.Tests/Integration/Primitive/PrimitiveAddDeleteTest.cs index 3c111c09..be06db94 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Primitive/PrimitiveAddDeleteTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Primitive/PrimitiveAddDeleteTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.Integration.Primitive { - public class PrimitiveAddDeleteTest : TestBase + public partial class PrimitiveAddDeleteTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Properties/UnversionedOptimisticLockingFieldTest.cs b/Src/NHibernate.Envers.Tests/Integration/Properties/UnversionedOptimisticLockingFieldTest.cs index 2900b611..a15dd375 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Properties/UnversionedOptimisticLockingFieldTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Properties/UnversionedOptimisticLockingFieldTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Properties { - public class UnversionedOptimisticLockingFieldTest : TestBase + public partial class UnversionedOptimisticLockingFieldTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Properties/VersionsPropertiesTest.cs b/Src/NHibernate.Envers.Tests/Integration/Properties/VersionsPropertiesTest.cs index 32222092..8375d724 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Properties/VersionsPropertiesTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Properties/VersionsPropertiesTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Properties { - public class VersionsPropertiesTest : TestBase + public partial class VersionsPropertiesTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/Proxy/AuditedCollectionProxyTest.cs b/Src/NHibernate.Envers.Tests/Integration/Proxy/AuditedCollectionProxyTest.cs index f74ed201..247b2769 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Proxy/AuditedCollectionProxyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Proxy/AuditedCollectionProxyTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Proxy { - public class AuditedCollectionProxyTest : TestBase + public partial class AuditedCollectionProxyTest : TestBase { public AuditedCollectionProxyTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/Proxy/ProxyIdentifierTest.cs b/Src/NHibernate.Envers.Tests/Integration/Proxy/ProxyIdentifierTest.cs index 659ffa8e..8b1683c9 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Proxy/ProxyIdentifierTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Proxy/ProxyIdentifierTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.Proxy { - public class ProxyIdentifierTest : TestBase + public partial class ProxyIdentifierTest : TestBase { private TargetNotAuditedEntity tnae1; private ManyToOneNotAuditedNullEntity mtonane1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Proxy/RemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Proxy/RemovedObjectQueryTest.cs index 2a178fc8..deb901ff 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Proxy/RemovedObjectQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Proxy/RemovedObjectQueryTest.cs @@ -13,7 +13,7 @@ namespace NHibernate.Envers.Tests.Integration.Proxy { - public class RemovedObjectQueryTest : TestBase + public partial class RemovedObjectQueryTest : TestBase { private int stringSetId; private UnversionedStrTestEntity unversionedEntity1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/AggregateQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/AggregateQueryTest.cs index df7398f7..c15caaca 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/AggregateQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/AggregateQueryTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class AggregateQueryTest : TestBase + public partial class AggregateQueryTest : TestBase { public AggregateQueryTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/CustomRevEntityQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/CustomRevEntityQueryTest.cs index 2345b675..802bdd62 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/CustomRevEntityQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/CustomRevEntityQueryTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class CustomRevEntityQueryTest : TestBase + public partial class CustomRevEntityQueryTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/DeletedEntitiesTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/DeletedEntitiesTest.cs index dae572f6..6cbedaa1 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/DeletedEntitiesTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/DeletedEntitiesTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class DeletedEntitiesTest : TestBase + public partial class DeletedEntitiesTest : TestBase { private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/Ids/EmbIdOneToManyQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/Ids/EmbIdOneToManyQueryTest.cs index af860525..8b827131 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/Ids/EmbIdOneToManyQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/Ids/EmbIdOneToManyQueryTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Query.Ids { - public class EmbIdOneToManyQueryTest : TestBase + public partial class EmbIdOneToManyQueryTest : TestBase { private EmbId id1; private EmbId id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/MaximalizePropertyQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/MaximalizePropertyQueryTest.cs index 0a7ab5d2..41dbfe33 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/MaximalizePropertyQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/MaximalizePropertyQueryTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class MaximalizePropertyQueryTest : TestBase + public partial class MaximalizePropertyQueryTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/NullPropertyQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/NullPropertyQueryTest.cs index 119b270f..9fbeb2a4 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/NullPropertyQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/NullPropertyQueryTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class NullPropertyQueryTest : TestBase + public partial class NullPropertyQueryTest : TestBase { private int idSimplePropertyNull; private int idSimplePropertyNotNull; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/OrderByLimitQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/OrderByLimitQueryTest.cs index 8f72f96e..9354b655 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/OrderByLimitQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/OrderByLimitQueryTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class OrderByLimitQueryTest : TestBase + public partial class OrderByLimitQueryTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/RevisionConstraintQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/RevisionConstraintQueryTest.cs index 7425b37d..65a8758d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/RevisionConstraintQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/RevisionConstraintQueryTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class RevisionConstraintQueryTest : TestBase + public partial class RevisionConstraintQueryTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/SimpleQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/SimpleQueryTest.cs index 3ecd339e..585d86e1 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/SimpleQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/SimpleQueryTest.cs @@ -10,7 +10,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class SimpleQueryTest : TestBase + public partial class SimpleQueryTest : TestBase { private int id1; private int id2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/StoreDeletedDataTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/StoreDeletedDataTest.cs index f1cf958a..8d0f4a1f 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/StoreDeletedDataTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/StoreDeletedDataTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.Integration.Query { - public class StoreDeletedDataTest : TestBase + public partial class StoreDeletedDataTest : TestBase { private int id1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Query/Traverse/AssociationToOneQueryTest.cs b/Src/NHibernate.Envers.Tests/Integration/Query/Traverse/AssociationToOneQueryTest.cs index b76d4c08..3cf5d284 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Query/Traverse/AssociationToOneQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Query/Traverse/AssociationToOneQueryTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Query.Traverse { - public class AssociationToOneQueryTest : TestBase + public partial class AssociationToOneQueryTest : TestBase { private int fordId; private int toyotaId; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomColumnMappingTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomColumnMappingTest.cs index d9732548..0c579678 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomColumnMappingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomColumnMappingTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class CustomColumnMappingTest : TestBase + public partial class CustomColumnMappingTest : TestBase { private int id; private DateTime timestamp1; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomDateTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomDateTest.cs index ee8246e3..8f1dd09d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomDateTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomDateTest.cs @@ -10,7 +10,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class CustomDateTest : TestBase + public partial class CustomDateTest : TestBase { private int id; private DateTime timestamp1; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomFieldAccessTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomFieldAccessTest.cs index 00aa19f7..02798bf4 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomFieldAccessTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomFieldAccessTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class CustomFieldAccessTest : TestBase + public partial class CustomFieldAccessTest : TestBase { private int id; private DateTime timestamp1; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomFieldCamelcaseAccessTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomFieldCamelcaseAccessTest.cs index ef2609c5..f240c72e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomFieldCamelcaseAccessTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomFieldCamelcaseAccessTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class CustomFieldCamelcaseAccessTest : TestBase + public partial class CustomFieldCamelcaseAccessTest : TestBase { private int id; private DateTime timestamp1; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomNoListenerTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomNoListenerTest.cs index 06a55f21..2fd41477 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomNoListenerTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomNoListenerTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class CustomNoListenerTest : TestBase + public partial class CustomNoListenerTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomTest.cs index b97d3f73..8d0488cd 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/CustomTest.cs @@ -10,7 +10,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class CustomTest : TestBase + public partial class CustomTest : TestBase { private int id; private DateTime timestamp1; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/ExceptionListenerTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/ExceptionListenerTest.cs index 4b4d56da..49484522 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/ExceptionListenerTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/ExceptionListenerTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class ExceptionListenerTest : TestBase + public partial class ExceptionListenerTest : TestBase { public ExceptionListenerTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/InheritedTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/InheritedTest.cs index 2a5ce877..b3413a86 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/InheritedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/InheritedTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class InheritedTest : TestBase + public partial class InheritedTest : TestBase { private int id; private DateTime timestamp1; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/ListenerTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/ListenerTest.cs index 8065def3..784ac74b 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/ListenerTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/ListenerTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity { - public class ListenerTest : TestBase + public partial class ListenerTest : TestBase { private int id; private DateTime timestamp1; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/TrackModifiedEntities/DefaultTrackingEntitiesTest.cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/TrackModifiedEntities/DefaultTrackingEntitiesTest.cs index 9e52ea3b..3c0f3a6d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/TrackModifiedEntities/DefaultTrackingEntitiesTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/TrackModifiedEntities/DefaultTrackingEntitiesTest.cs @@ -13,7 +13,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity.TrackModifiedEntities /// Tests proper behavior of tracking modified entity types when nhibernate.envers.track_entities_changed_in_revision /// parameter is set to true. /// - public class DefaultTrackingEntitiesTest : TestBase + public partial class DefaultTrackingEntitiesTest : TestBase { private int steId; private int siteId; diff --git a/Src/NHibernate.Envers.Tests/Integration/RevEntity/TrackModifiedEntities/TrackingEntitiesMultipleChangesTest .cs b/Src/NHibernate.Envers.Tests/Integration/RevEntity/TrackModifiedEntities/TrackingEntitiesMultipleChangesTest .cs index eedba2c8..7e0ee9db 100644 --- a/Src/NHibernate.Envers.Tests/Integration/RevEntity/TrackModifiedEntities/TrackingEntitiesMultipleChangesTest .cs +++ b/Src/NHibernate.Envers.Tests/Integration/RevEntity/TrackModifiedEntities/TrackingEntitiesMultipleChangesTest .cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.Integration.RevEntity.TrackModifiedEntities { - public class TrackingEntitiesMultipleChangesTest : TestBase + public partial class TrackingEntitiesMultipleChangesTest : TestBase { private int steId1; private int steId2; diff --git a/Src/NHibernate.Envers.Tests/Integration/SameIds/SameIdsTest.cs b/Src/NHibernate.Envers.Tests/Integration/SameIds/SameIdsTest.cs index 2d6d21f5..cd06f0f7 100644 --- a/Src/NHibernate.Envers.Tests/Integration/SameIds/SameIdsTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/SameIds/SameIdsTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.SameIds { - public class SameIdsTest : TestBase + public partial class SameIdsTest : TestBase { public SameIdsTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/Integration/Serialization/SerializingCollectionTest.cs b/Src/NHibernate.Envers.Tests/Integration/Serialization/SerializingCollectionTest.cs index b05b0a86..bfe80870 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Serialization/SerializingCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Serialization/SerializingCollectionTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Serialization { - public class SerializingCollectionTest : TestBase + public partial class SerializingCollectionTest : TestBase { private const int ed1_id = 15; private const int ing1_id =21; diff --git a/Src/NHibernate.Envers.Tests/Integration/Strategy/IdentifierReuseTest.cs b/Src/NHibernate.Envers.Tests/Integration/Strategy/IdentifierReuseTest.cs index bea9a94a..dabfa3bb 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Strategy/IdentifierReuseTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Strategy/IdentifierReuseTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Strategy { - public class IdentifierReuseTest :TestBase + public partial class IdentifierReuseTest :TestBase { private const int reusedId = 11; diff --git a/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyComponentCollectionRevEndTest .cs b/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyComponentCollectionRevEndTest .cs index cc111799..a19ecf0a 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyComponentCollectionRevEndTest .cs +++ b/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyComponentCollectionRevEndTest .cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.Integration.Strategy { - public class ValidityAuditStrategyComponentCollectionRevEndTest : ValidityTestBase + public partial class ValidityAuditStrategyComponentCollectionRevEndTest : ValidityTestBase { private int productId; diff --git a/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyManyToManyTest.cs b/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyManyToManyTest.cs index 0437a100..b1df748d 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyManyToManyTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyManyToManyTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.Strategy { - public class ValidityAuditStrategyManyToManyTest : ValidityTestBase + public partial class ValidityAuditStrategyManyToManyTest : ValidityTestBase { private const int ingId = 1; private const int edId = 2; diff --git a/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyRevEndTestCustomRevEntTest.cs b/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyRevEndTestCustomRevEntTest.cs index f303028a..505f9c56 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyRevEndTestCustomRevEntTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyRevEndTestCustomRevEntTest.cs @@ -11,7 +11,7 @@ namespace NHibernate.Envers.Tests.Integration.Strategy { - public class ValidityAuditStrategyRevEndTestCustomRevEntTest : ValidityTestBase + public partial class ValidityAuditStrategyRevEndTestCustomRevEntTest : ValidityTestBase { private const string revendTimestampColumName = "REVEND_TIMESTAMP"; diff --git a/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyRevEndTimestampTest.cs b/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyRevEndTimestampTest.cs index 8617a754..1aa92420 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyRevEndTimestampTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Strategy/ValidityAuditStrategyRevEndTimestampTest.cs @@ -13,7 +13,7 @@ namespace NHibernate.Envers.Tests.Integration.Strategy { - public class ValidityAuditStrategyRevEndTimestampTest : ValidityTestBase + public partial class ValidityAuditStrategyRevEndTimestampTest : ValidityTestBase { private const string revendTimestampColumName = "REVEND_TIMESTAMP"; diff --git a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs index 690eff84..7a79eae9 100644 --- a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditAtMethodSuperclassLevel.AuditAllSubclass { - public class MappedSubclassingAllAuditedTest : TestBase + public partial class MappedSubclassingAllAuditedTest : TestBase { private int id1_1; private int id2_1; diff --git a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs index fb8fe1f5..346e237e 100644 --- a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditAtMethodSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditAtMethodSuperclassLevel.AuditMethodSubclass { - public class MappedSubclassingMethodAuditedTest : TestBase + public partial class MappedSubclassingMethodAuditedTest : TestBase { private int id1_1; private int id2_1; diff --git a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/AuditClassOverrideTest.cs b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/AuditClassOverrideTest.cs index 99183852..c981c3c0 100644 --- a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/AuditClassOverrideTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/AuditClassOverrideTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditOverride { - public class AuditClassOverrideTest : TestBase + public partial class AuditClassOverrideTest : TestBase { private int classAuditedEntityId; private int classNotAuditedEntityId; diff --git a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/AuditPropertyOverrideTest.cs b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/AuditPropertyOverrideTest.cs index cbbb4ce1..134736e1 100644 --- a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/AuditPropertyOverrideTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/AuditPropertyOverrideTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditOverride { - public class AuditPropertyOverrideTest : TestBase + public partial class AuditPropertyOverrideTest : TestBase { private int propertyEntityId; private int transitiveEntityId; diff --git a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/MixedOverrideTest .cs b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/MixedOverrideTest .cs index cc29f17f..532a1ee5 100644 --- a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/MixedOverrideTest .cs +++ b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditOverride/MixedOverrideTest .cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditOverride { - public class MixedOverrideTest : TestBase + public partial class MixedOverrideTest : TestBase { private int mixedEntityId; diff --git a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditedAtSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditedAtSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs index 8b6f0f92..ce9e5af6 100644 --- a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditedAtSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditedAtSuperclassLevel/AuditAllSubclass/MappedSubclassingAllAuditedTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditedAtSuperclassLevel.AuditAllSubclass { - public class MappedSubclassingAllAuditedTest : TestBase + public partial class MappedSubclassingAllAuditedTest : TestBase { private int id1_1; private int id2_1; diff --git a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditedAtSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditedAtSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs index da779d29..19a30485 100644 --- a/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditedAtSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/SuperClass/AuditedAtSuperclassLevel/AuditMethodSubclass/MappedSubclassingMethodAuditedTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.Integration.SuperClass.AuditedAtSuperclassLevel.AuditMethodSubclass { - public class MappedSubclassingMethodAuditedTest : TestBase + public partial class MappedSubclassingMethodAuditedTest : TestBase { private int id1_1; private int id2_1; diff --git a/Src/NHibernate.Envers.Tests/Integration/Versioning/NoOptimisticLockAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Versioning/NoOptimisticLockAuditingTest.cs index 6a9c5f9a..85eaa2b8 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Versioning/NoOptimisticLockAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Versioning/NoOptimisticLockAuditingTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.Integration.Versioning { - public class NoOptimisticLockAuditingTest : TestBase + public partial class NoOptimisticLockAuditingTest : TestBase { private const int id = 17; diff --git a/Src/NHibernate.Envers.Tests/Integration/Versioning/OptimisticLockAuditingTest.cs b/Src/NHibernate.Envers.Tests/Integration/Versioning/OptimisticLockAuditingTest.cs index d90e0ac0..c2f37e00 100644 --- a/Src/NHibernate.Envers.Tests/Integration/Versioning/OptimisticLockAuditingTest.cs +++ b/Src/NHibernate.Envers.Tests/Integration/Versioning/OptimisticLockAuditingTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.Integration.Versioning { - public class OptimisticLockAuditingTest : TestBase + public partial class OptimisticLockAuditingTest : TestBase { private const int id =47; diff --git a/Src/NHibernate.Envers.Tests/NHibernate.Envers.Tests.csproj b/Src/NHibernate.Envers.Tests/NHibernate.Envers.Tests.csproj index f6aff957..22d06ccd 100644 --- a/Src/NHibernate.Envers.Tests/NHibernate.Envers.Tests.csproj +++ b/Src/NHibernate.Envers.Tests/NHibernate.Envers.Tests.csproj @@ -19,7 +19,7 @@ - + diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/None/ManyToOne/Fixture.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/None/ManyToOne/Fixture.cs index 6f08888e..f4bfa8f2 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/None/ManyToOne/Fixture.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/None/ManyToOne/Fixture.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Access.None.ManyToOne { - public class Fixture : TestBase + public partial class Fixture : TestBase { private int parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/None/SimpleProperty/Fixture.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/None/SimpleProperty/Fixture.cs index c814dc17..e99acabf 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/None/SimpleProperty/Fixture.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/None/SimpleProperty/Fixture.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Access.None.SimpleProperty { - public class Fixture : TestBase + public partial class Fixture : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/Readonly/ReadonlyAccessTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/Readonly/ReadonlyAccessTest.cs index c1e34df4..33a90fc7 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/Readonly/ReadonlyAccessTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Access/Readonly/ReadonlyAccessTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Access.Readonly { - public class ReadonlyAccessTest : TestBase + public partial class ReadonlyAccessTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BiDirOneToOneWithOneSideNotAudited/BiDirOneToOneWithOneSideNotAuditedTests.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BiDirOneToOneWithOneSideNotAudited/BiDirOneToOneWithOneSideNotAuditedTests.cs index 599183c2..9fe578f4 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BiDirOneToOneWithOneSideNotAudited/BiDirOneToOneWithOneSideNotAuditedTests.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BiDirOneToOneWithOneSideNotAudited/BiDirOneToOneWithOneSideNotAuditedTests.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.BiDirOneToOneWithOneSideNotAudited { - public class BiDirOneToOneWithOneSideNotAuditedTests : TestBase + public partial class BiDirOneToOneWithOneSideNotAuditedTests : TestBase { private Guid parentId; private string childLatestStr; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BidirectionalList/DifferentAccessTest/BidirectionalListWithDifferentAccessTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BidirectionalList/DifferentAccessTest/BidirectionalListWithDifferentAccessTest.cs index c5131e8b..a0f01a67 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BidirectionalList/DifferentAccessTest/BidirectionalListWithDifferentAccessTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BidirectionalList/DifferentAccessTest/BidirectionalListWithDifferentAccessTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.BidirectionalList.DifferentAccessTest { - public class BidirectionalListWithDifferentAccessTest : TestBase + public partial class BidirectionalListWithDifferentAccessTest : TestBase { private int parent_id; private int child1_id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BidirectionalSameColumn/TwoRelationEndsSameColumnTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BidirectionalSameColumn/TwoRelationEndsSameColumnTest.cs index 917b830d..25447849 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BidirectionalSameColumn/TwoRelationEndsSameColumnTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/BidirectionalSameColumn/TwoRelationEndsSameColumnTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.BidirectionalSameColumn { - public class TwoRelationEndsSameColumnTest : TestBase + public partial class TwoRelationEndsSameColumnTest : TestBase { private const int modelId = 112; private const int modelConfigurationId = 2987; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Component/DerivedComponentTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Component/DerivedComponentTest.cs index a4ee620e..2e7efe9c 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Component/DerivedComponentTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Component/DerivedComponentTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Component { - public class DerivedComponentTest : TestBase + public partial class DerivedComponentTest : TestBase { private const int id = 111; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Component/SimpleStructTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Component/SimpleStructTest.cs index 75ae0be2..4fe35491 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Component/SimpleStructTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Component/SimpleStructTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Component { - public class SimpleStructTest : TestBase + public partial class SimpleStructTest : TestBase { private const int id = 111; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ComponentAsId/ComponentAsIdTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ComponentAsId/ComponentAsIdTest.cs index 30a009e9..6c1fac56 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ComponentAsId/ComponentAsIdTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ComponentAsId/ComponentAsIdTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.ComponentAsId { - public class ComponentAsIdTest : TestBase + public partial class ComponentAsIdTest : TestBase { public ComponentAsIdTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Configuration/NoRevisionOnCollectionChangeTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Configuration/NoRevisionOnCollectionChangeTest.cs index 5d40e259..6448e06f 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Configuration/NoRevisionOnCollectionChangeTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Configuration/NoRevisionOnCollectionChangeTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Configuration { - public class NoRevisionOnCollectionChangeTest : TestBase + public partial class NoRevisionOnCollectionChangeTest : TestBase { private int parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Configuration/SchemaForAbstractUnionSubclassTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Configuration/SchemaForAbstractUnionSubclassTest.cs index fcd9694d..9bc1a243 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Configuration/SchemaForAbstractUnionSubclassTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Configuration/SchemaForAbstractUnionSubclassTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Configuration { - public class SchemaForAbstractUnionSubclassTest : TestBase + public partial class SchemaForAbstractUnionSubclassTest : TestBase { private long id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Ctor/NonPublicCtorTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Ctor/NonPublicCtorTest.cs index 1802b1f8..28030850 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Ctor/NonPublicCtorTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Ctor/NonPublicCtorTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Ctor { - public class NonPublicCtorTest : TestBase + public partial class NonPublicCtorTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomMapping/ImplicitEnversCollectionType/Fixture.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomMapping/ImplicitEnversCollectionType/Fixture.cs index 0be6a617..a6c15053 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomMapping/ImplicitEnversCollectionType/Fixture.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomMapping/ImplicitEnversCollectionType/Fixture.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.CustomMapping.ImplicitEnversCollectionType { - public class Fixture : TestBase + public partial class Fixture : TestBase { private int parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomMapping/UserCollection/ParameterizedUserCollectionTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomMapping/UserCollection/ParameterizedUserCollectionTest.cs index ea2255d3..ed9e9387 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomMapping/UserCollection/ParameterizedUserCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomMapping/UserCollection/ParameterizedUserCollectionTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.CustomMapping.UserCollection { - public class ParameterizedUserCollectionTest : TestBase + public partial class ParameterizedUserCollectionTest : TestBase { private const int id = 123; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomType/CLOBCustomTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomType/CLOBCustomTest.cs index 327bdd9a..414a84c8 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomType/CLOBCustomTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/CustomType/CLOBCustomTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.CustomType { - public class CLOBCustomTest : TestBase + public partial class CLOBCustomTest : TestBase { private int ccte_id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/AddAndRemovePropertyTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/AddAndRemovePropertyTest.cs index 272712b0..b659a5aa 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/AddAndRemovePropertyTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/AddAndRemovePropertyTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.DynamicComponent { - public class AddAndRemovePropertyTest : TestBase + public partial class AddAndRemovePropertyTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/JoinWithDynamicComponent/BasicJoinWithDynamicComponentTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/JoinWithDynamicComponent/BasicJoinWithDynamicComponentTest.cs index a4887d24..c2db5508 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/JoinWithDynamicComponent/BasicJoinWithDynamicComponentTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/JoinWithDynamicComponent/BasicJoinWithDynamicComponentTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.DynamicComponent.JoinWithDynamicComponent { - public class BasicJoinWithDynamicComponentTest : TestBase + public partial class BasicJoinWithDynamicComponentTest : TestBase { private long id_car1; private long id_car2; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/MultiplePropertyTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/MultiplePropertyTest.cs index 4b93df3c..7bca96e1 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/MultiplePropertyTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/MultiplePropertyTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.DynamicComponent { - public class MultiplePropertyTest : TestBase + public partial class MultiplePropertyTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/NonExistingKeyTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/NonExistingKeyTest.cs index d7563d35..f9a86d68 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/NonExistingKeyTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/DynamicComponent/NonExistingKeyTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.DynamicComponent { - public class NonExistingKeyTest : TestBase + public partial class NonExistingKeyTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/EntityInstantiation/FactoryTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/EntityInstantiation/FactoryTest.cs index f117176f..60561361 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/EntityInstantiation/FactoryTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/EntityInstantiation/FactoryTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.EntityInstantiation { - public class FactoryTest : TestBase + public partial class FactoryTest : TestBase { int id1; int id2; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/EnumType/CustomEnumTypeTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/EnumType/CustomEnumTypeTest.cs index 0ec480fd..1cf23e0e 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/EnumType/CustomEnumTypeTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/EnumType/CustomEnumTypeTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.EnumType { - public class CustomEnumTypeTest : TestBase + public partial class CustomEnumTypeTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ForceInitialize/ForceInitializeTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ForceInitialize/ForceInitializeTest.cs index 2d372aee..b94c7332 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ForceInitialize/ForceInitializeTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ForceInitialize/ForceInitializeTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.ForceInitialize { - public class ForceInitializeTest : TestBase + public partial class ForceInitializeTest : TestBase { private Guid parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/Fixture.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/Fixture.cs index 04895399..99b16a30 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/Fixture.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/Fixture.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.IdBag.ManyToMany.UniDirectional { - public class Fixture : TestBase + public partial class Fixture : TestBase { private Guid owningId1; private Guid owningId2; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/FixtureWithModifiedFlagTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/FixtureWithModifiedFlagTest.cs index c3215d89..7cc4aade 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/FixtureWithModifiedFlagTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/IdBag/ManyToMany/UniDirectional/FixtureWithModifiedFlagTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.IdBag.ManyToMany.UniDirectional { - public class FixtureWithModifiedFlagTest : TestBase + public partial class FixtureWithModifiedFlagTest : TestBase { private Guid owningId; private Guid ownedId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Inheritance/Discriminator/Discriminate/DiscriminatorTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Inheritance/Discriminator/Discriminate/DiscriminatorTest.cs index 91988aca..fcad42bc 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Inheritance/Discriminator/Discriminate/DiscriminatorTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Inheritance/Discriminator/Discriminate/DiscriminatorTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Inheritance.Discrimina /// Provides a basic set of tests to verify when the insert attribute of the discriminator element is set /// to false, that the setting will carry into the audit table settings. /// - public class DiscriminatorTest : TestBase + public partial class DiscriminatorTest : TestBase { private BaseEntity baseEntityVer1; private BaseEntity baseEntityVer2; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/InsertUpdateFalse/InsertUpdateFalseComponentTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/InsertUpdateFalse/InsertUpdateFalseComponentTest.cs index 48287860..bb60140c 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/InsertUpdateFalse/InsertUpdateFalseComponentTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/InsertUpdateFalse/InsertUpdateFalseComponentTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.InsertUpdateFalse { - public class InsertUpdateFalseComponentTest : TestBase + public partial class InsertUpdateFalseComponentTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedCollection/NoAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedCollection/NoAuditedCollectionTest.cs index 14ed8746..70b00dd3 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedCollection/NoAuditedCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedCollection/NoAuditedCollectionTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Join.NoAuditedCollection { - public class NoAuditedCollectionTest : TestBase + public partial class NoAuditedCollectionTest : TestBase { private const int id = 15; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedCollectionWithAudited/NoAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedCollectionWithAudited/NoAuditedCollectionTest.cs index bf31de24..ebc6d1e5 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedCollectionWithAudited/NoAuditedCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedCollectionWithAudited/NoAuditedCollectionTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Join.NoAuditedCollectionWithAudited { - public class NoAuditedCollectionTest : TestBase + public partial class NoAuditedCollectionTest : TestBase { private const int id = 44; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedProperties/NoAuditedCollectionTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedProperties/NoAuditedCollectionTest.cs index 1be8b91f..d811f455 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedProperties/NoAuditedCollectionTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Join/NoAuditedProperties/NoAuditedCollectionTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Join.NoAuditedProperties { - public class NoAuditedCollectionTest : TestBase + public partial class NoAuditedCollectionTest : TestBase { private const int id = 44; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/JoinAuditTable/MultipleJoinAuditTableTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/JoinAuditTable/MultipleJoinAuditTableTest.cs index e93f4753..c840dd18 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/JoinAuditTable/MultipleJoinAuditTableTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/JoinAuditTable/MultipleJoinAuditTableTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.JoinAuditTable { - public class MultipleJoinAuditTableTest : TestBase + public partial class MultipleJoinAuditTableTest : TestBase { private const int id = 425; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ManyToMany/WithModifiedFlag/SaveNewItemTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ManyToMany/WithModifiedFlag/SaveNewItemTest.cs index 452017b5..477eeedc 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ManyToMany/WithModifiedFlag/SaveNewItemTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ManyToMany/WithModifiedFlag/SaveNewItemTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.ManyToMany.WithModifiedFlag { - public class SaveNewItemTest : TestBase + public partial class SaveNewItemTest : TestBase { private long id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ManyToOne/LazyProperty/LazyPropertyTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ManyToOne/LazyProperty/LazyPropertyTest.cs index 63588b5d..c6fc9c09 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ManyToOne/LazyProperty/LazyPropertyTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ManyToOne/LazyProperty/LazyPropertyTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.ManyToOne.LazyProperty { - public class LazyPropertyTest : TestBase + public partial class LazyPropertyTest : TestBase { private long id_pers1; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Merge/AddEditCollectionItemTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Merge/AddEditCollectionItemTest.cs index 341e7a80..1ed547e4 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Merge/AddEditCollectionItemTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Merge/AddEditCollectionItemTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Merge { - public class AddEditCollectionItemTest : TestBase + public partial class AddEditCollectionItemTest : TestBase { private const int entityId = 342; private const int childId = 1000; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ModifiedFlags/CollectionItemChangingParent/Fixture.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ModifiedFlags/CollectionItemChangingParent/Fixture.cs index 2bb14cc8..7fa926b7 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ModifiedFlags/CollectionItemChangingParent/Fixture.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ModifiedFlags/CollectionItemChangingParent/Fixture.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.ModifiedFlags.CollectionItemChangingParent { - public class Fixture : TestBase + public partial class Fixture : TestBase { private object _newOwnerId; private object _carId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ModifiedFlags/MergeColModTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ModifiedFlags/MergeColModTest.cs index 2575ce27..05183af5 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ModifiedFlags/MergeColModTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/ModifiedFlags/MergeColModTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.ModifiedFlags { - public class MergeColModTest : TestBase + public partial class MergeColModTest : TestBase { public MergeColModTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/MultiLevelInheritance/InheritanceWithoutInverseTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/MultiLevelInheritance/InheritanceWithoutInverseTest.cs index 6298b9de..26b27dd1 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/MultiLevelInheritance/InheritanceWithoutInverseTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/MultiLevelInheritance/InheritanceWithoutInverseTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.MultiLevelInheritance { - public class InheritanceWithoutInverseTest : TestBase + public partial class InheritanceWithoutInverseTest : TestBase { public InheritanceWithoutInverseTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreExistsInBaseTypeTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreExistsInBaseTypeTest.cs index 1331fa5f..3045fab2 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreExistsInBaseTypeTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreExistsInBaseTypeTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.NotFoundIgnore.BaseType { - public class NotFoundIgnoreExistsInBaseTypeTest : TestBase + public partial class NotFoundIgnoreExistsInBaseTypeTest : TestBase { private Guid parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreNotExistsInBaseTypeTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreNotExistsInBaseTypeTest.cs index 0266a69d..56c5aca8 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreNotExistsInBaseTypeTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotFoundIgnore/BaseType/NotFoundIgnoreNotExistsInBaseTypeTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.NotFoundIgnore.BaseType { - public class NotFoundIgnoreNotExistsInBaseTypeTest : TestBase + public partial class NotFoundIgnoreNotExistsInBaseTypeTest : TestBase { private Guid parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotUpdatable/DetachedTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotUpdatable/DetachedTest.cs index b508bffb..48bcbf25 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotUpdatable/DetachedTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/NotUpdatable/DetachedTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.NotUpdatable { - public class DetachedUpdateTest : TestBase + public partial class DetachedUpdateTest : TestBase { private long id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/OneToMany/UniDirectionalWithBackRefTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/OneToMany/UniDirectionalWithBackRefTest.cs index 7a3a205f..269c6122 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/OneToMany/UniDirectionalWithBackRefTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/OneToMany/UniDirectionalWithBackRefTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.OneToMany { - public class UniDirectionalWithBackRefTest : TestBase + public partial class UniDirectionalWithBackRefTest : TestBase { private Guid parentId; private Guid child1Id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/OneToOne/OneToOnePrimaryKeyTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/OneToOne/OneToOnePrimaryKeyTest.cs index 701dbc69..f65a40ff 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/OneToOne/OneToOnePrimaryKeyTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/OneToOne/OneToOnePrimaryKeyTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.OneToOne { - public class OneToOnePrimaryKeyTest : TestBase + public partial class OneToOnePrimaryKeyTest : TestBase { private const int id = 47; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Performance/EvictAfterTx/EvictAuditDataAfterCommitTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Performance/EvictAfterTx/EvictAuditDataAfterCommitTest.cs index 982872d6..41cc9309 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Performance/EvictAfterTx/EvictAuditDataAfterCommitTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Performance/EvictAfterTx/EvictAuditDataAfterCommitTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Performance.EvictAfterTx { - public class EvictAuditDataAfterCommitTest : TestBase + public partial class EvictAuditDataAfterCommitTest : TestBase { public EvictAuditDataAfterCommitTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/PersistRevisionInfo/FlushGetCurrentRevisionTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/PersistRevisionInfo/FlushGetCurrentRevisionTest.cs index 94cb815a..0e4dc17b 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/PersistRevisionInfo/FlushGetCurrentRevisionTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/PersistRevisionInfo/FlushGetCurrentRevisionTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.PersistRevisionInfo { - public class FlushGetCurrentRevisionTest : TestBase + public partial class FlushGetCurrentRevisionTest : TestBase { public FlushGetCurrentRevisionTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/PropertyNull/PrimitiveNullTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/PropertyNull/PrimitiveNullTest.cs index a40e2063..f169dd09 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/PropertyNull/PrimitiveNullTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/PropertyNull/PrimitiveNullTest.cs @@ -3,7 +3,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.PropertyNull { - public class PrimitiveNullTest : TestBase + public partial class PrimitiveNullTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/BagRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/BagRemovedObjectQueryTest.cs index 816ff455..0bf7062b 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/BagRemovedObjectQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/BagRemovedObjectQueryTest.cs @@ -11,7 +11,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy { //tests OneAuditEntityQueryGenerator - public class BagRemovedObjectQueryTest : TestBase + public partial class BagRemovedObjectQueryTest : TestBase { private Guid parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/ListRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/ListRemovedObjectQueryTest.cs index 074cd124..134395db 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/ListRemovedObjectQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/ListRemovedObjectQueryTest.cs @@ -11,7 +11,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy { //tests TwoEntityQueryGenerator - public class ListRemovedObjectQueryTest : TestBase + public partial class ListRemovedObjectQueryTest : TestBase { private Guid parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/MapRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/MapRemovedObjectQueryTest.cs index 220771b7..ba0c2d7b 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/MapRemovedObjectQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/MapRemovedObjectQueryTest.cs @@ -10,7 +10,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy { //tests ThreeEntityQueryGenerator - public class MapRemovedObjectQueryTest : TestBase + public partial class MapRemovedObjectQueryTest : TestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/OneToManyToNotAuditedRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/OneToManyToNotAuditedRemovedObjectQueryTest.cs index 67749915..2b1d5cee 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/OneToManyToNotAuditedRemovedObjectQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/OneToManyToNotAuditedRemovedObjectQueryTest.cs @@ -10,7 +10,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy { //TwoEntityOneAuditedQueryGenerator - public class OneToManyToNotAuditedRemovedObjectQueryTest : TestBase + public partial class OneToManyToNotAuditedRemovedObjectQueryTest : TestBase { private long parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/OneToOneRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/OneToOneRemovedObjectQueryTest.cs index 6a0de0ac..c00f4d3d 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/OneToOneRemovedObjectQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/OneToOneRemovedObjectQueryTest.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy { - public class OneToOneRemovedObjectQueryTest : TestBase + public partial class OneToOneRemovedObjectQueryTest : TestBase { private const int id =125; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/StringCollectionRemovedObjectQueryTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/StringCollectionRemovedObjectQueryTest.cs index c0f2e921..69eaeef1 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/StringCollectionRemovedObjectQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Proxy/StringCollectionRemovedObjectQueryTest.cs @@ -10,7 +10,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Proxy { //tests OneEntityQueryGenerator - public class StringCollectionRemovedObjectQueryTest : TestBase + public partial class StringCollectionRemovedObjectQueryTest : TestBase { private int parentId; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/ComponentQueryTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/ComponentQueryTest.cs index 85ad0f69..1c292fa8 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/ComponentQueryTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/ComponentQueryTest.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Query { - public class ComponentQueryTest : TestBase + public partial class ComponentQueryTest : TestBase { private const int id = 1345; private const int personWeight = 80; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/ComponentInTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/ComponentInTest.cs index e4f6a1bf..eb6e5cad 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/ComponentInTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/ComponentInTest.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Query.RelationIn { - public class ComponentInTest : TestBase + public partial class ComponentInTest : TestBase { public ComponentInTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/RelationEmbInTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/RelationEmbInTest.cs index aabbafa8..852178d0 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/RelationEmbInTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/RelationEmbInTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Query.RelationIn { - public class RelationEmbInTest : TestBase + public partial class RelationEmbInTest : TestBase { private EmbIdTestEntity embEnt; private EmbIdTestEntity embEntNoRef1; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/RelationInTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/RelationInTest.cs index 60fc1ae8..c8233b53 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/RelationInTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Query/RelationIn/RelationInTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Query.RelationIn { - public class RelationInTest : TestBase + public partial class RelationInTest : TestBase { private SetRefIngEntity ing; private SetRefEdEntity ed; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/ChangeListenerInstanceTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/ChangeListenerInstanceTest.cs index 6038d96e..6ec3a660 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/ChangeListenerInstanceTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/ChangeListenerInstanceTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.RevInfo { - public class ChangeListenerInstanceTest : TestBase + public partial class ChangeListenerInstanceTest : TestBase { private testListener listener; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/Time/DateTimeTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/Time/DateTimeTest.cs index e0773b17..16c1f5d8 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/Time/DateTimeTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/Time/DateTimeTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.RevInfo.Time { - public class DateTimeTest : TestBase + public partial class DateTimeTest : TestBase { public DateTimeTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/Time/LongTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/Time/LongTest.cs index 7324bdc4..6f43e585 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/Time/LongTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/RevInfo/Time/LongTest.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.RevInfo.Time { - public class LongTest : TestBase + public partial class LongTest : TestBase { public LongTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/SortedSetAndMap/SortedSetAndMapTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/SortedSetAndMap/SortedSetAndMapTest.cs index 3139926a..e697a464 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/SortedSetAndMap/SortedSetAndMapTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/SortedSetAndMap/SortedSetAndMapTest.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.SortedSetAndMap { - public class SortedSetAndMapTest : TestBase + public partial class SortedSetAndMapTest : TestBase { private Guid id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Strategy/SetOfValues/SetOfValuesTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Strategy/SetOfValues/SetOfValuesTest.cs index 64634c3b..ffbe8ec5 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Strategy/SetOfValues/SetOfValuesTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Strategy/SetOfValues/SetOfValuesTest.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Strategy.SetOfValues { - public class SetOfValuesTest : ValidityTestBase + public partial class SetOfValuesTest : ValidityTestBase { private int id; diff --git a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Transaction/RollbackAuditExceptionTest.cs b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Transaction/RollbackAuditExceptionTest.cs index a68bb450..af61bf21 100644 --- a/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Transaction/RollbackAuditExceptionTest.cs +++ b/Src/NHibernate.Envers.Tests/NetSpecific/Integration/Transaction/RollbackAuditExceptionTest.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Tests.NetSpecific.Integration.Transaction { - public class RollbackAuditExceptionTest : TestBase + public partial class RollbackAuditExceptionTest : TestBase { public RollbackAuditExceptionTest(AuditStrategyForTest strategyType) : base(strategyType) { diff --git a/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/AbstractOneToOneMapper.cs b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/AbstractOneToOneMapper.cs new file mode 100644 index 00000000..f010a6cb --- /dev/null +++ b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/AbstractOneToOneMapper.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Entities.Mapper.Relation +{ + using System.Threading.Tasks; + using System.Threading; + public abstract partial class AbstractOneToOneMapper : AbstractToOneMapper + { + + protected override async Task NullSafeMapToEntityFromMapAsync(AuditConfiguration verCfg, object obj, IDictionary data, object primaryKey, IAuditReaderImplementor versionsReader, long revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var referencedEntity = GetEntityInfo(verCfg, _referencedEntityName); + var removed = RevisionType.Deleted.Equals(data[verCfg.AuditEntCfg.RevisionTypePropName]); + object value; + try + { + value = await (QueryForReferencedEntityAsync(versionsReader, referencedEntity, primaryKey, revision, removed, cancellationToken)).ConfigureAwait(false); + } + catch (NonUniqueResultException e) + { + throw new AuditException("Many versions results for one-to-one relationship " + _entityName + "." + PropertyData.BeanName + ".", e); + } + + SetPropertyValue(obj, value); + } + + protected abstract Task QueryForReferencedEntityAsync(IAuditReaderImplementor versionsReader, EntityInfo referencedEntity, object primaryKey, long revision, bool removed, CancellationToken cancellationToken = default(CancellationToken)); + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/AbstractToOneMapper.cs b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/AbstractToOneMapper.cs new file mode 100644 index 00000000..cc88be19 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/AbstractToOneMapper.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using System.Collections.Generic; +using NHibernate.Collection; +using NHibernate.Engine; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Reader; +using NHibernate.Envers.Tools; +using NHibernate.Envers.Tools.Reflection; + +namespace NHibernate.Envers.Entities.Mapper.Relation +{ + using System.Threading.Tasks; + using System.Threading; + public abstract partial class AbstractToOneMapper : IPropertyMapper + { + + + protected abstract Task NullSafeMapToEntityFromMapAsync(AuditConfiguration verCfg, object obj, IDictionary data, + object primaryKey, IAuditReaderImplementor versionsReader, long revision, CancellationToken cancellationToken = default(CancellationToken)); + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/Lazy/Initializor/AbstractCollectionInitializor.cs b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/Lazy/Initializor/AbstractCollectionInitializor.cs new file mode 100644 index 00000000..96f5dda6 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/Lazy/Initializor/AbstractCollectionInitializor.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Entities.Mapper.Relation.Lazy.Initializor +{ + using System.Threading.Tasks; + using System.Threading; + public abstract partial class AbstractCollectionInitializor : IInitializor + { + + public async Task InitializeAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var collectionContent = await (_queryGenerator.GetQuery(_versionsReader, _primaryKey, Revision, _removed).ListAsync(cancellationToken)).ConfigureAwait(false); + var collection = InitializeCollection(collectionContent.Count); + foreach (var collectionRow in collectionContent) + { + AddToCollection(collection, collectionRow); + } + return collection; + } + } +} diff --git a/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/Lazy/Initializor/IInitializor.cs b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/Lazy/Initializor/IInitializor.cs new file mode 100644 index 00000000..f7c57331 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/Lazy/Initializor/IInitializor.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace NHibernate.Envers.Entities.Mapper.Relation.Lazy.Initializor +{ + using System.Threading.Tasks; + using System.Threading; + public partial interface IInitializor + { + Task InitializeAsync(CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/OneToOneNotOwningMapper.cs b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/OneToOneNotOwningMapper.cs new file mode 100644 index 00000000..02058022 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/OneToOneNotOwningMapper.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using NHibernate.Envers.Query; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Entities.Mapper.Relation +{ + using System.Threading.Tasks; + using System.Threading; + public partial class OneToOneNotOwningMapper : AbstractOneToOneMapper + { + + protected override async Task QueryForReferencedEntityAsync(IAuditReaderImplementor versionsReader, EntityInfo referencedEntity, object primaryKey, long revision, bool removed, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (versionsReader.CreateQuery().ForEntitiesAtRevision(referencedEntity.EntityClass, revision) + .Add(AuditEntity.RelatedId(_owningReferencePropertyName).Eq(primaryKey)) + .GetSingleResultAsync(cancellationToken)).ConfigureAwait(false); + } + } +} diff --git a/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/OneToOnePrimaryKeyJoinColumnMapper.cs b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/OneToOnePrimaryKeyJoinColumnMapper.cs new file mode 100644 index 00000000..5f2713f6 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/OneToOnePrimaryKeyJoinColumnMapper.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Entities.Mapper.Relation +{ + using System.Threading.Tasks; + using System.Threading; + public partial class OneToOnePrimaryKeyJoinColumnMapper : AbstractOneToOneMapper + { + + protected override async Task QueryForReferencedEntityAsync(IAuditReaderImplementor versionsReader, EntityInfo referencedEntity, object primaryKey, long revision, bool removed, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + if (referencedEntity.IsAudited) + { + return await (versionsReader.FindAsync(referencedEntity.EntityName, primaryKey, revision, removed, cancellationToken)).ConfigureAwait(false); + } + //Not audited revision + return createNotAuditedEntityReference(versionsReader, referencedEntity.EntityClass, + referencedEntity.EntityName, primaryKey); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/ToOneEntityLoader.cs b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/ToOneEntityLoader.cs new file mode 100644 index 00000000..fd7dc158 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/ToOneEntityLoader.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Relation.Lazy; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Entities.Mapper.Relation +{ + using System.Threading.Tasks; + using System.Threading; + public static partial class ToOneEntityLoader + { + public static async Task LoadImmediateAsync(IAuditReaderImplementor versionsReader, string entityName, + object entityId, long revision, bool removed, AuditConfiguration verCfg, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + if (verCfg.EntCfg.GetNotVersionEntityConfiguration(entityName) == null) + { + // Audited relation, look up entity with Envers. + // When user traverses removed entities graph, do not restrict revision type of referencing objects + // to ADD or MOD (DEL possible). See HHH-5845. + return await (versionsReader.FindAsync(entityName, entityId, revision, removed, cancellationToken)).ConfigureAwait(false); + } + // Not audited relation, look up entity with Hibernate. + return await (versionsReader.SessionImplementor.ImmediateLoadAsync(entityName, entityId, cancellationToken)).ConfigureAwait(false); + } + + public static async Task CreateProxyOrLoadImmediateAsync(IAuditReaderImplementor versionsReader, string entityName, + object entityId, long revision, bool removed, AuditConfiguration verCfg, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var persister = versionsReader.SessionImplementor.Factory.GetEntityPersister(entityName); + if (persister.HasProxy) + { + return persister.CreateProxy(entityId, + new ToOneDelegateSessionImplementor(versionsReader, entityName, entityId, revision, removed, verCfg)); + } + + return await (LoadImmediateAsync(versionsReader, entityName, entityId, revision, removed, verCfg, cancellationToken)).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/ToOneIdMapper.cs b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/ToOneIdMapper.cs new file mode 100644 index 00000000..adbb687c --- /dev/null +++ b/Src/NHibernate.Envers/Async/Entities/Mapper/Relation/ToOneIdMapper.cs @@ -0,0 +1,55 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using System.Collections.Generic; +using NHibernate.Engine; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Id; +using NHibernate.Envers.Reader; +using NHibernate.Envers.Tools; +using NHibernate.Envers.Tools.Query; + +namespace NHibernate.Envers.Entities.Mapper.Relation +{ + using System.Threading.Tasks; + using System.Threading; + public partial class ToOneIdMapper : AbstractToOneMapper + { + + protected override async Task NullSafeMapToEntityFromMapAsync(AuditConfiguration verCfg, object obj, IDictionary data, object primaryKey, IAuditReaderImplementor versionsReader, long revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var entityId = _delegat.MapToIdFromMap(data); + object value = null; + if (entityId != null) + { + if (!versionsReader.FirstLevelCache.TryGetValue(_referencedEntityName, revision, entityId, out value)) + { + var referencedEntity = GetEntityInfo(verCfg, _referencedEntityName); + var ignoreNotFound = false; + if (!referencedEntity.IsAudited) + { + var referencingEntityName = verCfg.EntCfg.GetEntityNameForVersionsEntityName((string) data["$type$"]); + var relation = verCfg.EntCfg.GetRelationDescription(referencingEntityName, PropertyData.Name); + ignoreNotFound = relation != null && relation.IsIgnoreNotFound; + } + var removed = RevisionType.Deleted.Equals(data[verCfg.AuditEntCfg.RevisionTypePropName]); + + value = ignoreNotFound ? + await (ToOneEntityLoader.LoadImmediateAsync(versionsReader, _referencedEntityName, entityId, revision, removed, verCfg, cancellationToken)).ConfigureAwait(false) : + await (ToOneEntityLoader.CreateProxyOrLoadImmediateAsync(versionsReader, _referencedEntityName, entityId, revision, removed, verCfg, cancellationToken)).ConfigureAwait(false); + } + } + SetPropertyValue(obj, value); + } + } +} diff --git a/Src/NHibernate.Envers/Async/IAuditReader.cs b/Src/NHibernate.Envers/Async/IAuditReader.cs new file mode 100644 index 00000000..adfd08a0 --- /dev/null +++ b/Src/NHibernate.Envers/Async/IAuditReader.cs @@ -0,0 +1,136 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using NHibernate.Envers.Configuration.Attributes; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Query; + +namespace NHibernate.Envers +{ + using System.Threading.Tasks; + using System.Threading; + public partial interface IAuditReader + { + /// + /// Find an entity by primary key at the given revision. + /// + /// Type of entity + /// Primary key of the entity. + /// Revision in which to get the entity + /// A cancellation token that can be used to cancel the work + /// + /// The found entity instance at the given revision (its properties may be partially filled + /// if not all properties are audited) or null, if an entity with that id didn't exist at that + /// revision. + /// + Task FindAsync(object primaryKey, long revision, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Find an entity by primary key at the given revision. + /// + /// Type of entity + /// Primary key of the entity. + /// Revision in which to get the entity + /// A cancellation token that can be used to cancel the work + /// + /// The found entity instance at the given revision (its properties may be partially filled + /// if not all properties are audited) or null, if an entity with that id didn't exist at that + /// revision. + /// + Task FindAsync(System.Type cls, object primaryKey, long revision, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Find an entity by primary key at the given revision with the specified entityName. + /// + /// Name of the entity (if can't be guessed basing on the {@code cls}). + /// Primary key of the entity. + /// Revision in which to get the entity + /// A cancellation token that can be used to cancel the work + /// + /// The found entity instance at the given revision (its properties may be partially filled + /// if not all properties are audited) or null, if an entity with that id didn't exist at that + /// revision. + /// + Task FindAsync(string entityName, object primaryKey, long revision, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Find an entity by primary key at the given revision with the specified entityName, + /// possibly including deleted entities in the search. + /// + /// Name of the entity (if can't be guessed basing on the {@code cls}). + /// Primary key of the entity. + /// Revision in which to get the entity + /// Whether to include deleted entities in the search. + /// A cancellation token that can be used to cancel the work + /// + /// The found entity instance at the given revision (its properties may be partially filled + /// if not all properties are audited) or null, if an entity with that id didn't exist at that + /// revision. + /// + Task FindAsync(string entityName, object primaryKey, long revision, bool includeDeletions, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Get a list of revision numbers, at which an entity was modified. + /// + /// Type of entity + /// Primary key of the entity. + /// A cancellation token that can be used to cancel the work + /// + /// A list of revision numbers, at which the entity was modified, sorted in ascending order (so older + /// revisions come first). + /// + Task> GetRevisionsAsync(System.Type cls, object primaryKey, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Get a list of revision numbers, at which an entity was modified, looking by entityName. + /// + /// Name of the entity + /// Primary key of the entity. + /// A cancellation token that can be used to cancel the work + /// + /// A list of revision numbers, at which the entity was modified, sorted in ascending order (so older + /// revisions come first). + /// + Task> GetRevisionsAsync(string entityName, object primaryKey, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Gets an instance of the current revision entity, to which any entries in the audit tables will be bound. + /// Please note the if {@code persist} is {@code false}, and no audited entities are modified in this session, + /// then the obtained revision entity instance won't be persisted. If {@code persist} is {@code true}, the revision + /// entity instance will always be persisted, regardless of whether audited entities are changed or not. + /// + /// Class of the revision entity. Should be annotated with {@link RevisionEntity}. + /// + /// If the revision entity is not yet persisted, should it become persisted. This way, the primary + /// identifier (id) will be filled (if it's assigned by the DB) and available, but the revision entity will be + /// persisted even if there are no changes to audited entities. Otherwise, the revision number (id) can be + /// null. + /// A cancellation token that can be used to cancel the work + /// The current revision entity, to which any entries in the audit tables will be bound. + Task GetCurrentRevisionAsync(bool persist, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Gets an instance of the current revision entity, to which any entries in the audit tables will be bound. + /// Please note the if {@code persist} is {@code false}, and no audited entities are modified in this session, + /// then the obtained revision entity instance won't be persisted. If {@code persist} is {@code true}, the revision + /// entity instance will always be persisted, regardless of whether audited entities are changed or not. + /// + /// + /// If the revision entity is not yet persisted, should it become persisted. This way, the primary + /// identifier (id) will be filled (if it's assigned by the DB) and available, but the revision entity will be + /// persisted even if there are no changes to audited entities. Otherwise, the revision number (id) can be + /// null. + /// A cancellation token that can be used to cancel the work + /// The current revision entity, to which any entries in the audit tables will be bound. + Task GetCurrentRevisionAsync(bool persist, CancellationToken cancellationToken = default(CancellationToken)); + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/ICrossTypeRevisionChangesReader.cs b/Src/NHibernate.Envers/Async/ICrossTypeRevisionChangesReader.cs new file mode 100644 index 00000000..989bc50e --- /dev/null +++ b/Src/NHibernate.Envers/Async/ICrossTypeRevisionChangesReader.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; + +namespace NHibernate.Envers +{ + using System.Threading.Tasks; + using System.Threading; + public partial interface ICrossTypeRevisionChangesReader + { + + /// + /// Find all entities changed (added, updated and removed) in a given revision. Executes n+1 SQL queries, + /// where n is a number of different entity classes modified within specified revision. + /// + /// Revision number. + /// A cancellation token that can be used to cancel the work + /// Snapshots of all audited entities changed in a given revision. + Task> FindEntitiesAsync(long revision, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Find all entities changed (added, updated and removed) in a given revision. Executes n+1 SQL queries, + /// where n is a number of different entity classes modified within specified revision. + /// + /// Revision number. + /// Type of modification + /// A cancellation token that can be used to cancel the work + /// Snapshots of all audited entities changed in a given revision and filtered by modification type. + Task> FindEntitiesAsync(long revision, RevisionType revisionType, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Find all entities changed (added, updated and removed) in a given revision grouped by modification type. + /// Executes mn+1 SQL queries, where: + ///
    + ///
  • n - number of different entity classes modified within specified revision.
  • + ///
  • m - number of different revision types. See enum.
  • + ///
+ ///
+ /// Revision number. + /// A cancellation token that can be used to cancel the work + /// Map containing lists of entity snapshots grouped by modification operation (e.g. addition, update, removal). + Task>> FindEntitiesGroupByRevisionTypeAsync(long revision, CancellationToken cancellationToken = default(CancellationToken)); + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Query/IAuditQuery.cs b/Src/NHibernate.Envers/Async/Query/IAuditQuery.cs new file mode 100644 index 00000000..e01c30f4 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/IAuditQuery.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using NHibernate.Envers.Query.Criteria; +using NHibernate.Envers.Query.Order; +using NHibernate.Envers.Query.Projection; +using NHibernate.SqlCommand; + +namespace NHibernate.Envers.Query +{ + using System.Threading.Tasks; + using System.Threading; + public partial interface IAuditQuery + { + Task GetResultListAsync(CancellationToken cancellationToken = default(CancellationToken)); + Task> GetResultListAsync(CancellationToken cancellationToken = default(CancellationToken)); + + Task GetSingleResultAsync(CancellationToken cancellationToken = default(CancellationToken)); + + Task GetSingleResultAsync(CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/Src/NHibernate.Envers/Async/Query/IEntityAuditQuery.cs b/Src/NHibernate.Envers/Async/Query/IEntityAuditQuery.cs new file mode 100644 index 00000000..7e9b524b --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/IEntityAuditQuery.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Envers.Query.Criteria; +using NHibernate.Envers.Query.Order; +using NHibernate.SqlCommand; + +namespace NHibernate.Envers.Query +{ + using System.Threading.Tasks; + using System.Threading; + public partial interface IEntityAuditQuery where T: class + { + Task> ResultsAsync(CancellationToken cancellationToken = default(CancellationToken)); + Task SingleAsync(CancellationToken cancellationToken = default(CancellationToken)); + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Query/Impl/AbstractAuditQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/AbstractAuditQuery.cs new file mode 100644 index 00000000..005ec93a --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/AbstractAuditQuery.cs @@ -0,0 +1,115 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Query.Criteria; +using NHibernate.Envers.Query.Order; +using NHibernate.Envers.Query.Projection; +using NHibernate.Envers.Reader; +using NHibernate.Envers.Tools.Query; +using System; +using System.Linq; +using NHibernate.SqlCommand; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public abstract partial class AbstractAuditQuery : IAuditQueryImplementor + { + + protected async Task BuildAndExecuteQueryAsync(IList result, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var query = BuildQuery(); + await (query.ListAsync(result, cancellationToken)).ConfigureAwait(false); + } + + protected abstract Task FillResultAsync(IList result, CancellationToken cancellationToken = default(CancellationToken)); + + public async Task GetResultListAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var ret = new ArrayList(); + await (FillResultAsync(ret, cancellationToken)).ConfigureAwait(false); + return ret; + } + + public async Task> GetResultListAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var ret = new List(); + await (FillResultAsync(ret, cancellationToken)).ConfigureAwait(false); + return ret; + } + + public async Task GetSingleResultAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return (T) await (GetSingleResultAsync(cancellationToken)).ConfigureAwait(false); + } + + public async Task GetSingleResultAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var result = new ArrayList(); + await (FillResultAsync(result, cancellationToken)).ConfigureAwait(false); + switch (result.Count) + { + case 0: + return null; + case 1: + return result[0]; + default: + throw new NonUniqueResultException(result.Count); + } + } + + protected async Task ApplyProjectionsAsync(IQuery query, IList resultToFill, long revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + if (HasProjection()) + { + foreach (var qr in await (query.ListAsync(cancellationToken)).ConfigureAwait(false)) + { + if (projections.Count == 1) + { + // qr is the value of the projection itself + var projection = projections[0]; + resultToFill.Add(projection.Item2.ConvertQueryResult(VerCfg, EntityInstantiator, projection.Item1, revision, qr)); + } + else + { + // qr is an array where each of its components holds the value of corresponding projection + var qresults = (object[]) qr; + var tresults = new object[qresults.Length]; + for (var i = 0; i < qresults.Length; i++) + { + var projection = projections[i]; + tresults[i] = projection.Item2.ConvertQueryResult(VerCfg, EntityInstantiator, projection.Item1, revision, qresults[i]); + } + resultToFill.Add(tresults); + } + } + } + else + { + var queryResult = new List(); + await (query.ListAsync(queryResult, cancellationToken)).ConfigureAwait(false); + EntityInstantiator.AddInstancesFromVersionsEntities(EntityName, resultToFill, queryResult, revision); + } + } + } +} diff --git a/Src/NHibernate.Envers/Async/Query/Impl/AbstractRevisionsQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/AbstractRevisionsQuery.cs new file mode 100644 index 00000000..ca93a627 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/AbstractRevisionsQuery.cs @@ -0,0 +1,75 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Query.Criteria; +using NHibernate.Envers.Query.Order; +using NHibernate.Envers.Reader; +using NHibernate.Envers.Tools.Query; +using NHibernate.Proxy; +using NHibernate.SqlCommand; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public abstract partial class AbstractRevisionsQuery : IEntityAuditQuery where TEntity : class + { + + public abstract Task> ResultsAsync(CancellationToken cancellationToken = default(CancellationToken)); + + public async Task SingleAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var results = await (ResultsAsync(cancellationToken)).ConfigureAwait(false); + using (var enumerator = results.GetEnumerator()) + { + if (!enumerator.MoveNext()) + { + return null; + } + var current = enumerator.Current; + if (!enumerator.MoveNext()) + { + return current; + } + } + + throw new NonUniqueResultException(2); // TODO : it need a modification in NH: the exception should work even without the count of results + } + + protected async Task> BuildAndExecuteQueryAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var querySb = new StringBuilder(); + var queryParamValues = new Dictionary(); + + QueryBuilder.Build(querySb, queryParamValues); + + var query = _versionsReader.Session.CreateQuery(querySb.ToString()); + foreach (var paramValue in queryParamValues) + { + query.SetParameter(paramValue.Key, paramValue.Value); + } + AddExtraParameter(query); + setQueryProperties(query); + + + return await (query.ListAsync(cancellationToken)).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Query/Impl/AllEntitiesAtRevisionQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/AllEntitiesAtRevisionQuery.cs new file mode 100644 index 00000000..85d4b408 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/AllEntitiesAtRevisionQuery.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Relation; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public partial class AllEntitiesAtRevisionQuery : AbstractRevisionsQuery where TEntity : class + { + + public override async Task> ResultsAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + /* + * The query that should be executed in the versions table: + * SELECT e FROM ent_ver e + * WHERE + * (all specified conditions, transformed, on the "e" entity) AND + * (selecting e entities at revision :revision) + * --> for DefaultAuditStrategy: + * e.revision = (SELECT max(e2.revision) FROM versionsReferencedEntity e2 + * WHERE e2.revision <= :revision AND e2.id = e.id) + * + * --> for ValidityAuditStrategy: + * e.revision <= :revision and (e.endRevision > :revision or e.endRevision is null) + * + * AND + * (only non-deleted entities) + * e.revision_type != DEL + */ + + var verEntCfg = AuditConfiguration.AuditEntCfg; + var revisionPropertyPath = verEntCfg.RevisionNumberPath; + var originalIdPropertyName = verEntCfg.OriginalIdPropName; + + var referencedIdData = new MiddleIdData(verEntCfg, AuditConfiguration.EntCfg[EntityName].IdMappingData, + null, EntityName, AuditConfiguration.EntCfg.IsVersioned(EntityName)); + + // (selecting e entities at revision :revision) + // --> based on auditStrategy (see above) + AuditConfiguration.GlobalCfg.AuditStrategy.AddEntityAtRevisionRestriction(QueryBuilder, QueryBuilder.RootParameters, revisionPropertyPath, + verEntCfg.RevisionEndFieldName, true, referencedIdData, + revisionPropertyPath, originalIdPropertyName, QueryConstants.ReferencedEntityAlias, QueryConstants.ReferencedEntityAliasDefAudStr); + SetIncludeDeletationClause(); + + AddCriterions(); + + // the result of BuildAndExecuteQuery is always the name-value pair of EntityMode.Map + var result = await (BuildAndExecuteQueryAsync(cancellationToken)).ConfigureAwait(false); + return from versionsEntity in result + select (TEntity)EntityInstantiator.CreateInstanceFromVersionsEntity(EntityName, versionsEntity, _revision); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Query/Impl/AuditAssociationQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/AuditAssociationQuery.cs new file mode 100644 index 00000000..7877bb0d --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/AuditAssociationQuery.cs @@ -0,0 +1,57 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Id; +using NHibernate.Envers.Entities.Mapper.Relation; +using NHibernate.Envers.Query.Criteria; +using NHibernate.Envers.Query.Order; +using NHibernate.Envers.Query.Projection; +using NHibernate.Envers.Reader; +using NHibernate.Envers.Tools.Query; +using NHibernate.SqlCommand; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public partial class AuditAssociationQuery : IAuditQueryImplementor + { + + + public async Task GetResultListAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (_parent.GetResultListAsync(cancellationToken)).ConfigureAwait(false); + } + + public async Task> GetResultListAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (_parent.GetResultListAsync(cancellationToken)).ConfigureAwait(false); + } + + public async Task GetSingleResultAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (_parent.GetSingleResultAsync(cancellationToken)).ConfigureAwait(false); + } + + public async Task GetSingleResultAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (_parent.GetSingleResultAsync(cancellationToken)).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Query/Impl/AuditRevisionsAssociationQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/AuditRevisionsAssociationQuery.cs new file mode 100644 index 00000000..96407686 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/AuditRevisionsAssociationQuery.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Id; +using NHibernate.Envers.Entities.Mapper.Relation; +using NHibernate.Envers.Query.Criteria; +using NHibernate.Envers.Query.Order; +using NHibernate.Envers.Reader; +using NHibernate.Envers.Tools.Query; +using NHibernate.SqlCommand; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public partial class AuditRevisionsAssociationQuery : IEntityAuditQuery where TEntity : class + { + + public async Task> ResultsAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (_parent.ResultsAsync(cancellationToken)).ConfigureAwait(false); + } + + public async Task SingleAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (_parent.SingleAsync(cancellationToken)).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Query/Impl/EntitiesAtRevisionQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/EntitiesAtRevisionQuery.cs new file mode 100644 index 00000000..7d85ac61 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/EntitiesAtRevisionQuery.cs @@ -0,0 +1,83 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Linq; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Relation; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public partial class EntitiesAtRevisionQuery : AbstractAuditQuery + { + + protected override async Task FillResultAsync(IList result, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + /* + * The query that we need to create: + * SELECT new list(e) FROM versionsReferencedEntity e + * WHERE + * (all specified conditions, transformed, on the "e" entity) AND + * (selecting e entities at revision :revision) + * --> for DefaultAuditStrategy: + * e.revision = (SELECT max(e2.revision) FROM versionsReferencedEntity e2 + * WHERE e2.revision <= :revision AND e2.id = e.id) + * + * --> for ValidityAuditStrategy: + * e.revision <= :revision and (e.endRevision > :revision or e.endRevision is null) + * + * AND + * (only non-deleted entities) + * e.revision_type != DEL + */ + var verEntCfg = VerCfg.AuditEntCfg; + var revisionPropertyPath = verEntCfg.RevisionNumberPath; + var originalIdPropertyName = verEntCfg.OriginalIdPropName; + + var referencedIdData = new MiddleIdData(verEntCfg, VerCfg.EntCfg[EntityName].IdMappingData, + null, EntityName, VerCfg.EntCfg.IsVersioned(EntityName)); + + // (selecting e entities at revision :revision) + // --> based on auditStrategy (see above) + VerCfg.GlobalCfg.AuditStrategy.AddEntityAtRevisionRestriction(QueryBuilder, QueryBuilder.RootParameters, revisionPropertyPath, + verEntCfg.RevisionEndFieldName, true, referencedIdData, + revisionPropertyPath, originalIdPropertyName, QueryConstants.ReferencedEntityAlias, QueryConstants.ReferencedEntityAliasDefAudStr); + + // e.revision_type != DEL + if (!_includeDeletions) + { + QueryBuilder.RootParameters.AddWhereWithParam(verEntCfg.RevisionTypePropName, "<>", RevisionType.Deleted); + } + + // all specified conditions + foreach (var criterion in Criterions) + { + criterion.AddToQuery(VerCfg, VersionsReader, EntityName, QueryBuilder, QueryBuilder.RootParameters); + } + foreach (var associationQuery in AssociationQueries) + { + associationQuery.AddCriterionsToQuery(VersionsReader); + } + + var query = BuildQuery(); + // add named parameter (only used for ValidAuditTimeStrategy and association queries) + if (query.NamedParameters.Contains(QueryConstants.RevisionParameter)) + { + query.SetParameter(QueryConstants.RevisionParameter, _revision); + } + await (ApplyProjectionsAsync(query, result, _revision, cancellationToken)).ConfigureAwait(false); + } + } +} diff --git a/Src/NHibernate.Envers/Async/Query/Impl/EntitiesModifiedAtRevisionQuery .cs b/Src/NHibernate.Envers/Async/Query/Impl/EntitiesModifiedAtRevisionQuery .cs new file mode 100644 index 00000000..236520eb --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/EntitiesModifiedAtRevisionQuery .cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public partial class EntitiesModifiedAtRevisionQuery : AbstractAuditQuery + { + + protected override async Task FillResultAsync(IList result, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + /* + * The query that we need to create: + * SELECT new list(e) FROM versionsReferencedEntity e + * WHERE + * (all specified conditions, transformed, on the "e" entity) AND + * e.revision = :revision + */ + + var verEntCfg = VerCfg.AuditEntCfg; + var revisionPropertyPath = verEntCfg.RevisionNumberPath; + QueryBuilder.RootParameters.AddWhereWithParam(revisionPropertyPath, "=", _revision); + + foreach (var criterion in Criterions) + { + criterion.AddToQuery(VerCfg, VersionsReader, EntityName, QueryBuilder, QueryBuilder.RootParameters); + } + foreach (var associationQuery in AssociationQueries) + { + associationQuery.AddCriterionsToQuery(VersionsReader); + } + + var query = BuildQuery(); + await (ApplyProjectionsAsync(query, result, _revision, cancellationToken)).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Query/Impl/HistoryQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/HistoryQuery.cs new file mode 100644 index 00000000..67953b4b --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/HistoryQuery.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public partial class HistoryQuery : AbstractRevisionsQuery> + where TEntity : class + where TRevisionEntity : class + { + + public override async Task>> ResultsAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var auditEntitiesConfiguration = AuditConfiguration.AuditEntCfg; + /* + The query that should be executed in the versions table: + SELECT e FROM ent_ver e, rev_entity r WHERE + e.revision_type != DEL (if selectDeletedEntities == false) AND + e.revision = r.revision AND + (all specified conditions, transformed, on the "e" entity) + ORDER BY e.revision ASC (unless another order is specified) + */ + SetIncludeDeletationClause(); + AddCriterions(); + AddOrders(); + QueryBuilder.AddFrom(auditEntitiesConfiguration.RevisionInfoEntityFullClassName(), QueryConstants.RevisionAlias, true); + QueryBuilder.RootParameters.AddWhere(auditEntitiesConfiguration.RevisionNumberPath, true, "=", QueryConstants.RevisionAlias + ".id", false); + + var revisionTypePropertyName = auditEntitiesConfiguration.RevisionTypePropName; + + var result = await (BuildAndExecuteQueryAsync(cancellationToken)).ConfigureAwait(false); + return from resultRow in result + let versionsEntity = (IDictionary) resultRow[0] + let revisionData = (TRevisionEntity) resultRow[1] + let revision = GetRevisionNumberFromDynamicEntity(versionsEntity) + let entity = (TEntity) EntityInstantiator.CreateInstanceFromVersionsEntity(EntityName, versionsEntity, revision) + select new RevisionEntityInfo(entity, revisionData, (RevisionType) versionsEntity[revisionTypePropertyName]); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Query/Impl/RevisionsOfEntityQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/RevisionsOfEntityQuery.cs new file mode 100644 index 00000000..008dde27 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/RevisionsOfEntityQuery.cs @@ -0,0 +1,99 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Reader; +using NHibernate.Proxy; +using NHibernate.SqlCommand; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public partial class RevisionsOfEntityQuery : AbstractAuditQuery + { + + protected override async Task FillResultAsync(IList result, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var verEntCfg = VerCfg.AuditEntCfg; + + /* + The query that should be executed in the versions table: + SELECT e (unless another projection is specified) FROM ent_ver e, rev_entity r WHERE + e.revision_type != DEL (if selectDeletedEntities == false) AND + e.revision = r.revision AND + (all specified conditions, transformed, on the "e" entity) + ORDER BY e.revision ASC (unless another order or projection is specified) + */ + if (!_selectDeletedEntities) + { + // e.revision_type != DEL AND + QueryBuilder.RootParameters.AddWhereWithParam(verEntCfg.RevisionTypePropName, "<>", RevisionType.Deleted); + } + + // all specified conditions, transformed + foreach (var criterion in Criterions) + { + criterion.AddToQuery(VerCfg, VersionsReader, EntityName, QueryBuilder, QueryBuilder.RootParameters); + } + + if (!HasProjection() && !HasOrder) + { + var revisionPropertyPath = verEntCfg.RevisionNumberPath; + QueryBuilder.AddOrder(QueryConstants.ReferencedEntityAlias, revisionPropertyPath, true); + } + + if (!_selectEntitiesOnly) + { + QueryBuilder.AddFrom(VerCfg.AuditEntCfg.RevisionInfoEntityFullClassName(), QueryConstants.RevisionAlias, true); + QueryBuilder.RootParameters.AddWhere(VerCfg.AuditEntCfg.RevisionNumberPath, true, "=", QueryConstants.RevisionAlias + ".id", false); + } + + if (HasProjection()) + { + await (BuildAndExecuteQueryAsync(result, cancellationToken)).ConfigureAwait(false); + return; + } + var internalResult = new ArrayList(); + await (BuildAndExecuteQueryAsync(internalResult, cancellationToken)).ConfigureAwait(false); + + var revisionTypePropertyName = verEntCfg.RevisionTypePropName; + + foreach (var resultRow in internalResult) + { + IDictionary versionsEntity; + object revisionData = null; + + if (_selectEntitiesOnly) + { + versionsEntity = (IDictionary) resultRow; + } + else + { + var arrayResultRow = (Object[]) resultRow; + versionsEntity = (IDictionary) arrayResultRow[0]; + revisionData = arrayResultRow[1]; + } + + var revision = revisionNumber(versionsEntity); + + var entity = EntityInstantiator.CreateInstanceFromVersionsEntity(EntityName, versionsEntity, revision); + + result.Add(_selectEntitiesOnly + ? entity + : new[] {entity, revisionData, versionsEntity[revisionTypePropertyName]}); + } + } + } +} diff --git a/Src/NHibernate.Envers/Async/Query/Impl/RevisionsQuery.cs b/Src/NHibernate.Envers/Async/Query/Impl/RevisionsQuery.cs new file mode 100644 index 00000000..fc6958fa --- /dev/null +++ b/Src/NHibernate.Envers/Async/Query/Impl/RevisionsQuery.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Reader; + +namespace NHibernate.Envers.Query.Impl +{ + using System.Threading.Tasks; + using System.Threading; + public partial class RevisionsQuery : AbstractRevisionsQuery where TEntity : class + { + + public override async Task> ResultsAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + /* + The query that should be executed in the versions table: + SELECT e FROM ent_ver e, rev_entity r WHERE + e.revision_type != DEL (if includesDeletations == false) AND + e.revision = r.revision AND + (all specified conditions, transformed, on the "e" entity) + ORDER BY e.revision ASC (unless another order is specified) + */ + SetIncludeDeletationClause(); + + AddCriterions(); + + AddOrders(); + + // the result of BuildAndExecuteQuery is always the name-value pair of EntityMode.Map + var result = await (BuildAndExecuteQueryAsync(cancellationToken)).ConfigureAwait(false); + return from versionsEntity in result + let revision = GetRevisionNumberFromDynamicEntity(versionsEntity) + select (TEntity) EntityInstantiator.CreateInstanceFromVersionsEntity(EntityName, versionsEntity, revision); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Reader/AuditReader.cs b/Src/NHibernate.Envers/Async/Reader/AuditReader.cs new file mode 100644 index 00000000..10dfd810 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Reader/AuditReader.cs @@ -0,0 +1,124 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Engine; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Query; +using NHibernate.Envers.Tools; +using NHibernate.Event; +using NHibernate.Proxy; + +namespace NHibernate.Envers.Reader +{ + using System.Threading.Tasks; + using System.Threading; + public partial class AuditReader : IAuditReaderImplementor + { + + public async Task FindAsync(object primaryKey, long revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return (T)await (FindAsync(typeof(T), primaryKey, revision, cancellationToken)).ConfigureAwait(false); + } + + public async Task FindAsync(System.Type cls, object primaryKey, long revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (FindAsync(cls.FullName, primaryKey, revision, cancellationToken)).ConfigureAwait(false); + } + + public async Task FindAsync(string entityName, object primaryKey, long revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return await (FindAsync(entityName, primaryKey, revision, false, cancellationToken)).ConfigureAwait(false); + } + + public async Task FindAsync(string entityName, object primaryKey, long revision, bool includeDeletions, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + ArgumentsTools.CheckNotNull(primaryKey, "Primary key"); + ArgumentsTools.CheckPositive(revision, "Entity revision"); + + if (!verCfg.EntCfg.IsVersioned(entityName)) + { + throw new NotAuditedException(entityName, entityName + " is not versioned!"); + } + + object result; + if (FirstLevelCache.TryGetValue(entityName, revision, primaryKey, out result)) + { + return result; + } + + // The result is put into the cache by the entity instantiator called from the query + result = await (CreateQuery().ForEntitiesAtRevision(entityName, revision, includeDeletions) + .Add(AuditEntity.Id().Eq(primaryKey)).GetSingleResultAsync(cancellationToken)).ConfigureAwait(false); + + return result; + } + + public async Task> GetRevisionsAsync(System.Type cls, object primaryKey, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var entityName = cls.FullName; + return await (GetRevisionsAsync(entityName, primaryKey, cancellationToken)).ConfigureAwait(false); + } + + public async Task> GetRevisionsAsync(string entityName, object primaryKey, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + ArgumentsTools.CheckNotNull(primaryKey, "Primary key"); + + if (!verCfg.EntCfg.IsVersioned(entityName)) + { + throw new NotAuditedException(entityName, entityName + " is not versioned!"); + } + + var resultList = await (CreateQuery().ForRevisionsOfEntity(entityName, false, true) + .AddProjection(AuditEntity.RevisionNumber()) + .AddOrder(AuditEntity.RevisionNumber().Asc()) + .Add(AuditEntity.Id().Eq(primaryKey)) + .GetResultListAsync(cancellationToken)).ConfigureAwait(false); + return from object revision in resultList select Convert.ToInt64(revision); + } + + public Task GetCurrentRevisionAsync(bool persist, CancellationToken cancellationToken = default(CancellationToken)) + { + if (!(Session is IEventSource sessionAsEventSource)) + { + throw new NotSupportedException("The provided session is not an EventSource!"); + } + if (cancellationToken.IsCancellationRequested) + { + return Task.FromCanceled(cancellationToken); + } + return InternalGetCurrentRevisionAsync(); + async Task InternalGetCurrentRevisionAsync() + { + + // Obtaining the current audit sync + var auditSync = verCfg.AuditProcessManager.Get(sessionAsEventSource); + + // And getting the current revision data + return await (auditSync.CurrentRevisionDataAsync(Session, persist, cancellationToken)).ConfigureAwait(false); + } + } + + public async Task GetCurrentRevisionAsync(bool persist, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + return (T)await (GetCurrentRevisionAsync(persist, cancellationToken)).ConfigureAwait(false); + } + } +} diff --git a/Src/NHibernate.Envers/Async/Reader/CrossTypeRevisionChangesReader.cs b/Src/NHibernate.Envers/Async/Reader/CrossTypeRevisionChangesReader.cs new file mode 100644 index 00000000..5d6ada3a --- /dev/null +++ b/Src/NHibernate.Envers/Async/Reader/CrossTypeRevisionChangesReader.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Exceptions; +using NHibernate.Envers.Query.Criteria; +using NHibernate.Envers.Tools; + +namespace NHibernate.Envers.Reader +{ + using System.Threading.Tasks; + using System.Threading; + public partial class CrossTypeRevisionChangesReader : ICrossTypeRevisionChangesReader + { + + public async Task> FindEntitiesAsync(long revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var entityTypes = FindEntityTypes(revision); + var result = new List(); + foreach (var type in entityTypes) + { + result.AddRange(await (_auditReaderImplementor.CreateQuery().ForEntitiesModifiedAtRevision(type.Item1, revision).GetResultListAsync(cancellationToken)).ConfigureAwait(false)); + } + return result; + } + + public async Task> FindEntitiesAsync(long revision, RevisionType revisionType, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var entityTypes = FindEntityTypes(revision); + var result = new List(); + foreach (var type in entityTypes) + { + result.AddRange(await (_auditReaderImplementor.CreateQuery().ForEntitiesModifiedAtRevision(type.Item1, revision) + .Add(new RevisionTypeAuditExpression(revisionType, "=")).GetResultListAsync(cancellationToken)).ConfigureAwait(false)); + } + return result; + } + + public async Task>> FindEntitiesGroupByRevisionTypeAsync(long revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var entityTypes = FindEntityTypes(revision); + var result = new Dictionary>(); + foreach (var revType in Enum.GetValues(typeof(RevisionType))) + { + var revisionType = (RevisionType)revType; + var tempList = new List(); + foreach (var type in entityTypes) + { + var list = await (_auditReaderImplementor.CreateQuery().ForEntitiesModifiedAtRevision(type.Item1, revision) + .Add(new RevisionTypeAuditExpression(revisionType, "=")).GetResultListAsync(cancellationToken)).ConfigureAwait(false); + tempList.AddRange(list); + } + result[revisionType] = tempList; + } + return result; + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/RevisionInfo/DefaultRevisionInfoGenerator.cs b/Src/NHibernate.Envers/Async/RevisionInfo/DefaultRevisionInfoGenerator.cs new file mode 100644 index 00000000..2ee99895 --- /dev/null +++ b/Src/NHibernate.Envers/Async/RevisionInfo/DefaultRevisionInfoGenerator.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using NHibernate.Envers.Entities; +using NHibernate.Envers.Synchronization; +using NHibernate.Envers.Tools.Reflection; +using NHibernate.Properties; + +namespace NHibernate.Envers.RevisionInfo +{ + using System.Threading.Tasks; + using System.Threading; + public partial class DefaultRevisionInfoGenerator : IRevisionInfoGenerator + { + + public async Task SaveRevisionDataAsync(ISession session, object revisionData, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + await (session.SaveAsync(_revisionInfoEntityName, revisionData, cancellationToken)).ConfigureAwait(false); + SessionCacheCleaner.ScheduleAuditDataRemoval(session, revisionData); + } + } +} diff --git a/Src/NHibernate.Envers/Async/RevisionInfo/IRevisionInfoGenerator.cs b/Src/NHibernate.Envers/Async/RevisionInfo/IRevisionInfoGenerator.cs new file mode 100644 index 00000000..f3182cf6 --- /dev/null +++ b/Src/NHibernate.Envers/Async/RevisionInfo/IRevisionInfoGenerator.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace NHibernate.Envers.RevisionInfo +{ + using System.Threading.Tasks; + using System.Threading; + public partial interface IRevisionInfoGenerator + { + Task SaveRevisionDataAsync(ISession session, object revisionData, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/Src/NHibernate.Envers/Async/Strategy/DefaultAuditStrategy.cs b/Src/NHibernate.Envers/Async/Strategy/DefaultAuditStrategy.cs new file mode 100644 index 00000000..5730a3be --- /dev/null +++ b/Src/NHibernate.Envers/Async/Strategy/DefaultAuditStrategy.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Xml.Linq; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper; +using NHibernate.Envers.Entities.Mapper.Relation; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Synchronization; +using NHibernate.Envers.Tools.Query; + +namespace NHibernate.Envers.Strategy +{ + using System.Threading.Tasks; + using System.Threading; + public partial class DefaultAuditStrategy : IAuditStrategy + { + + public async Task PerformAsync(ISession session, string entityName, object id, object data, object revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + await (session.SaveAsync(_auditConfiguration.AuditEntCfg.GetAuditEntityName(entityName), data, cancellationToken)).ConfigureAwait(false); + SessionCacheCleaner.ScheduleAuditDataRemoval(session, data); + } + + public async Task PerformCollectionChangeAsync(ISession session, string entityName, string propertyName, AuditConfiguration auditCfg, PersistentCollectionChangeData persistentCollectionChangeData, object revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var data = persistentCollectionChangeData.Data; + await (session.SaveAsync(persistentCollectionChangeData.EntityName, data, cancellationToken)).ConfigureAwait(false); + SessionCacheCleaner.ScheduleAuditDataRemoval(session, data); + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Strategy/IAuditStrategy.cs b/Src/NHibernate.Envers/Async/Strategy/IAuditStrategy.cs new file mode 100644 index 00000000..189ae813 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Strategy/IAuditStrategy.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Xml.Linq; +using NHibernate.Collection; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper; +using NHibernate.Envers.Entities.Mapper.Relation; +using NHibernate.Envers.Tools.Query; + +namespace NHibernate.Envers.Strategy +{ + using System.Threading.Tasks; + using System.Threading; + public partial interface IAuditStrategy + { + + /// + /// Perform the persistence of audited data for regular entities. + /// + /// Session, which can be used to persist the data. + /// Name of the entity, in which the audited change happens + /// Id of the entity. + /// Audit data to persist + /// Current revision data + /// A cancellation token that can be used to cancel the work + Task PerformAsync(ISession session, string entityName, object id, object data, object revision, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Perform the persistence of audited data for collection ("middle") entities. + /// + /// Session, which can be used to persist the data. + /// Audit configuration + /// Collection change data to be persisted. + /// Current revision data + /// Name of the entity, in which the audited change happens. + /// The name of the property holding the + /// A cancellation token that can be used to cancel the work + Task PerformCollectionChangeAsync(ISession session, string entityName, string propertyName, AuditConfiguration auditCfg, PersistentCollectionChangeData persistentCollectionChangeData, object revision, CancellationToken cancellationToken = default(CancellationToken)); + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Strategy/ValidityAuditStrategy.cs b/Src/NHibernate.Envers/Async/Strategy/ValidityAuditStrategy.cs new file mode 100644 index 00000000..c452473b --- /dev/null +++ b/Src/NHibernate.Envers/Async/Strategy/ValidityAuditStrategy.cs @@ -0,0 +1,171 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Xml.Linq; +using NHibernate.Engine; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Configuration.Metadata; +using NHibernate.Envers.Entities.Mapper; +using NHibernate.Envers.Entities.Mapper.Relation; +using NHibernate.Envers.Entities.Mapper.Relation.Query; +using NHibernate.Envers.Synchronization; +using NHibernate.Envers.Tools.Query; +using NHibernate.Type; + +namespace NHibernate.Envers.Strategy +{ + using System.Threading.Tasks; + using System.Threading; + public partial class ValidityAuditStrategy : IAuditStrategy + { + + public async Task PerformAsync(ISession session, string entityName, object id, object data, object revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var auditedEntityName = _auditConfiguration.AuditEntCfg.GetAuditEntityName(entityName); + + var reuseEntityIdentifier = _auditConfiguration.GlobalCfg.AllowIdentifierReuse; + // Update the end date of the previous row if this operation is expected to have a previous row + var revisionTypeIsAdded = revisionType(_auditConfiguration, data) == RevisionType.Added; + if (reuseEntityIdentifier || !revisionTypeIsAdded) + { + /* + Constructing a query: + select e from audited_ent e where e.end_rev is null and e.id = :id + */ + var qb = new QueryBuilder(auditedEntityName, QueryConstants.MiddleEntityAlias); + + // e.id = :id + var idMapper = _auditConfiguration.EntCfg[entityName].IdMapper; + idMapper.AddIdEqualsToQuery(qb.RootParameters, id, _auditConfiguration.AuditEntCfg.OriginalIdPropName, true); + + addEndRevisionNullRestriction(_auditConfiguration, qb); + + var l = await (qb.ToQuery(session).SetLockMode(QueryConstants.MiddleEntityAlias, LockMode.Upgrade).ListAsync(cancellationToken)).ConfigureAwait(false); + + await (updateLastRevisionAsync(session, _auditConfiguration, l, id, auditedEntityName, revision, (!reuseEntityIdentifier || !revisionTypeIsAdded), cancellationToken)).ConfigureAwait(false); + } + + // Save the audit data + await (session.SaveAsync(auditedEntityName, data, cancellationToken)).ConfigureAwait(false); + SessionCacheCleaner.ScheduleAuditDataRemoval(session, data); + } + + public async Task PerformCollectionChangeAsync(ISession session, string entityName, string propertyName, AuditConfiguration auditCfg, PersistentCollectionChangeData persistentCollectionChangeData, object revision, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var qb = new QueryBuilder(persistentCollectionChangeData.EntityName, QueryConstants.MiddleEntityAlias); + + var originalIdPropName = _auditConfiguration.AuditEntCfg.OriginalIdPropName; + var originalId = (IDictionary)persistentCollectionChangeData.Data[originalIdPropName]; + var revisionFieldName = auditCfg.AuditEntCfg.RevisionFieldName; + var revisionTypePropName = auditCfg.AuditEntCfg.RevisionTypePropName; + + // Adding a parameter for each id component, except the rev number and type. + foreach (DictionaryEntry originalIdKeyValue in originalId) + { + if (!revisionFieldName.Equals(originalIdKeyValue.Key) && !revisionTypePropName.Equals(originalIdKeyValue.Key)) + { + qb.RootParameters.AddWhereWithParam(originalIdPropName + "." + originalIdKeyValue.Key, true, "=", originalIdKeyValue.Value); + } + } + + var sessionFactory = ((ISessionImplementor)session).Factory; + var propertyType = sessionFactory.GetEntityPersister(entityName).GetPropertyType(propertyName); + if (propertyType.IsCollectionType) + { + var collectionPropertyType = (CollectionType)propertyType; + // Handling collection of components. + if (collectionPropertyType.GetElementType(sessionFactory) is ComponentType) + { + // Adding restrictions to compare data outside of primary key. + // todo: is it necessary that non-primary key attributes be compared? + foreach (var dataEntry in persistentCollectionChangeData.Data) + { + if (!originalIdPropName.Equals(dataEntry.Key)) + { + if (dataEntry.Value != null) + { + qb.RootParameters.AddWhereWithParam(dataEntry.Key, true, "=", dataEntry.Value); + } + else + { + qb.RootParameters.AddNullRestriction(dataEntry.Key, true); + } + } + } + } + } + + addEndRevisionNullRestriction(_auditConfiguration, qb); + + var l = await (qb.ToQuery(session).SetLockMode(QueryConstants.MiddleEntityAlias, LockMode.Upgrade).ListAsync(cancellationToken)).ConfigureAwait(false); + + if (l.Count > 0) + { + await (updateLastRevisionAsync(session, _auditConfiguration, l, originalId, persistentCollectionChangeData.EntityName, revision, true, cancellationToken)).ConfigureAwait(false); + } + + // Save the audit data + var data = persistentCollectionChangeData.Data; + await (session.SaveAsync(persistentCollectionChangeData.EntityName, data, cancellationToken)).ConfigureAwait(false); + SessionCacheCleaner.ScheduleAuditDataRemoval(session, data); + } + + private async Task updateLastRevisionAsync(ISession session, AuditConfiguration auditCfg, IList l, + object id, string auditedEntityName, object revision, bool throwIfNotOneEntry, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + // There should be one entry + if (l.Count == 1) + { + // Setting the end revision to be the current rev + var previousData = (IDictionary) l[0]; + var revisionEndFieldName = auditCfg.AuditEntCfg.RevisionEndFieldName; + previousData[revisionEndFieldName] = revision; + + if (auditCfg.AuditEntCfg.IsRevisionEndTimestampEnabled) + { + // Determine the value of the revision property annotated with @RevisionTimestamp + DateTime revisionEndTimestamp; + var revEndTimestampFieldName = auditCfg.AuditEntCfg.RevisionEndTimestampFieldName; + var revEndTimestampObj = _auditConfiguration.RevisionTimestampGetter.Get(revision); + + // convert to a DateTime + if (revEndTimestampObj is DateTime) + { + revisionEndTimestamp = (DateTime) revEndTimestampObj; + } + else + { + revisionEndTimestamp = new DateTime((long) revEndTimestampObj); + } + + // Setting the end revision timestamp + previousData[revEndTimestampFieldName] = revisionEndTimestamp; + } + + // Saving the previous version + await (session.SaveAsync(auditedEntityName, previousData, cancellationToken)).ConfigureAwait(false); + SessionCacheCleaner.ScheduleAuditDataRemoval(session, previousData); + } + else + { + if (throwIfNotOneEntry) + { + throw new InvalidOperationException("Cannot find previous revision for entity " + auditedEntityName + " and id " + id); + } + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Synchronization/AuditProcess.cs b/Src/NHibernate.Envers/Async/Synchronization/AuditProcess.cs new file mode 100644 index 00000000..66b08088 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Synchronization/AuditProcess.cs @@ -0,0 +1,92 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using NHibernate.Engine; +using NHibernate.Envers.RevisionInfo; +using NHibernate.Envers.Synchronization.Work; +using NHibernate.Envers.Tools; + +namespace NHibernate.Envers.Synchronization +{ + using System.Threading.Tasks; + using System.Threading; + public partial class AuditProcess + { + + private async Task executeInSessionAsync(ISession executeSession, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + // Making sure the revision data is persisted. + var currentRevisionData = await (CurrentRevisionDataAsync(executeSession, true, cancellationToken)).ConfigureAwait(false); + + // First undoing any performed work units + while (undoQueue.Count > 0) + { + var vwu = undoQueue.Dequeue(); + await (vwu.UndoAsync(executeSession, cancellationToken)).ConfigureAwait(false); + } + + while (workUnits.Count > 0) + { + var vwu = workUnits.First.Value; + workUnits.RemoveFirst(); + await (vwu.PerformAsync(executeSession, revisionData, cancellationToken)).ConfigureAwait(false); + entityChangeNotifier.EntityChanged(currentRevisionData, vwu); + } + } + + + public async Task CurrentRevisionDataAsync(ISession executeSession, bool persist, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + // Generating the revision data if not yet generated + if (revisionData == null) + { + revisionData = revisionInfoGenerator.Generate(); + } + + // Saving the revision data, if not yet saved and persist is true + if (!revisionInfoPersistedInCurrentTransaction && persist) + { + await (revisionInfoGenerator.SaveRevisionDataAsync(executeSession, revisionData, cancellationToken)).ConfigureAwait(false); + revisionInfoPersistedInCurrentTransaction = true; + } + + return revisionData; + } + + public async Task DoBeforeTransactionCompletionAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + if (workUnits.Count == 0 && undoQueue.Count == 0) + { + return; + } + var castedSession = (ISession)session; + + if (castedSession.FlushMode == FlushMode.Manual) + { + using (var tempSession = Toolz.CreateChildSession(castedSession)) + { + await (executeInSessionAsync(tempSession, cancellationToken)).ConfigureAwait(false); + await (tempSession.FlushAsync(cancellationToken)).ConfigureAwait(false); + } + } + else + { + await (executeInSessionAsync(castedSession, cancellationToken)).ConfigureAwait(false); + // Explicity flushing the session, as the auto-flush may have already happened. + await (castedSession.FlushAsync(cancellationToken)).ConfigureAwait(false); + } + } + } +} \ No newline at end of file diff --git a/Src/NHibernate.Envers/Async/Synchronization/Work/AbstractAuditWorkUnit.cs b/Src/NHibernate.Envers/Async/Synchronization/Work/AbstractAuditWorkUnit.cs new file mode 100644 index 00000000..8e94239c --- /dev/null +++ b/Src/NHibernate.Envers/Async/Synchronization/Work/AbstractAuditWorkUnit.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Engine; +using NHibernate.Envers.Configuration; + +namespace NHibernate.Envers.Synchronization.Work +{ + using System.Threading.Tasks; + using System.Threading; + public abstract partial class AbstractAuditWorkUnit : IAuditWorkUnit + { + + public virtual async Task PerformAsync(ISession session, object revisionData, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var data = GenerateData(revisionData); + await (VerCfg.GlobalCfg.AuditStrategy.PerformAsync(session, EntityName, EntityId, data, revisionData, cancellationToken)).ConfigureAwait(false); + _performedData = data; + } + + public async Task UndoAsync(ISession session, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + if (IsPerformed()) + { + await (session.DeleteAsync(VerCfg.AuditEntCfg.GetAuditEntityName(EntityName), _performedData, cancellationToken)).ConfigureAwait(false); + await (session.FlushAsync(cancellationToken)).ConfigureAwait(false); + } + } + } +} diff --git a/Src/NHibernate.Envers/Async/Synchronization/Work/IAuditWorkUnit.cs b/Src/NHibernate.Envers/Async/Synchronization/Work/IAuditWorkUnit.cs new file mode 100644 index 00000000..72681d74 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Synchronization/Work/IAuditWorkUnit.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; + +namespace NHibernate.Envers.Synchronization.Work +{ + using System.Threading.Tasks; + using System.Threading; + public partial interface IAuditWorkUnit: IWorkUnitMergeVisitor, IWorkUnitMergeDispatcher + { + + /// + /// Perform this work unit in the given session. + /// + /// Session, in which the work unit should be performed. + /// + /// The current revision data, which will be used to populate the work unit with the correct revision relation. + /// + /// A cancellation token that can be used to cancel the work + Task PerformAsync(ISession session, object revisionData, CancellationToken cancellationToken = default(CancellationToken)); + + Task UndoAsync(ISession session, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/Src/NHibernate.Envers/Async/Synchronization/Work/PersistentCollectionChangeWorkUnit.cs b/Src/NHibernate.Envers/Async/Synchronization/Work/PersistentCollectionChangeWorkUnit.cs new file mode 100644 index 00000000..bd4d7993 --- /dev/null +++ b/Src/NHibernate.Envers/Async/Synchronization/Work/PersistentCollectionChangeWorkUnit.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System; +using System.Collections.Generic; +using System.Linq; +using NHibernate.Collection; +using NHibernate.Engine; +using NHibernate.Envers.Configuration; +using NHibernate.Envers.Entities.Mapper; +using NHibernate.Envers.Tools; + +namespace NHibernate.Envers.Synchronization.Work +{ + using System.Threading.Tasks; + using System.Threading; + public partial class PersistentCollectionChangeWorkUnit : AbstractAuditWorkUnit + { + + public override async Task PerformAsync(ISession session, object revisionData, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var entitiesCfg = VerCfg.AuditEntCfg; + + foreach (var persistentCollectionChangeData in collectionChanges) + { + // Setting the revision number + ((IDictionary) persistentCollectionChangeData.Data[entitiesCfg.OriginalIdPropName]) + .Add(entitiesCfg.RevisionFieldName, revisionData); + await (VerCfg.GlobalCfg.AuditStrategy.PerformCollectionChangeAsync(session, EntityName, referencingPropertyName, VerCfg, persistentCollectionChangeData, revisionData, cancellationToken)).ConfigureAwait(false); + } + } + } +} diff --git a/Src/NHibernate.Envers/Entities/Mapper/Relation/AbstractOneToOneMapper.cs b/Src/NHibernate.Envers/Entities/Mapper/Relation/AbstractOneToOneMapper.cs index a91dc792..6402f96d 100644 --- a/Src/NHibernate.Envers/Entities/Mapper/Relation/AbstractOneToOneMapper.cs +++ b/Src/NHibernate.Envers/Entities/Mapper/Relation/AbstractOneToOneMapper.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Entities.Mapper.Relation { [Serializable] - public abstract class AbstractOneToOneMapper : AbstractToOneMapper + public abstract partial class AbstractOneToOneMapper : AbstractToOneMapper { private readonly string _entityName; private readonly string _referencedEntityName; diff --git a/Src/NHibernate.Envers/Entities/Mapper/Relation/AbstractToOneMapper.cs b/Src/NHibernate.Envers/Entities/Mapper/Relation/AbstractToOneMapper.cs index c3b5b523..3314a80b 100644 --- a/Src/NHibernate.Envers/Entities/Mapper/Relation/AbstractToOneMapper.cs +++ b/Src/NHibernate.Envers/Entities/Mapper/Relation/AbstractToOneMapper.cs @@ -11,7 +11,7 @@ namespace NHibernate.Envers.Entities.Mapper.Relation { [Serializable] - public abstract class AbstractToOneMapper : IPropertyMapper + public abstract partial class AbstractToOneMapper : IPropertyMapper { protected AbstractToOneMapper(PropertyData propertyData) { diff --git a/Src/NHibernate.Envers/Entities/Mapper/Relation/Lazy/Initializor/AbstractCollectionInitializor.cs b/Src/NHibernate.Envers/Entities/Mapper/Relation/Lazy/Initializor/AbstractCollectionInitializor.cs index 7f23767e..3719108e 100644 --- a/Src/NHibernate.Envers/Entities/Mapper/Relation/Lazy/Initializor/AbstractCollectionInitializor.cs +++ b/Src/NHibernate.Envers/Entities/Mapper/Relation/Lazy/Initializor/AbstractCollectionInitializor.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Entities.Mapper.Relation.Lazy.Initializor { - public abstract class AbstractCollectionInitializor : IInitializor + public abstract partial class AbstractCollectionInitializor : IInitializor { private readonly IAuditReaderImplementor _versionsReader; private readonly IRelationQueryGenerator _queryGenerator; diff --git a/Src/NHibernate.Envers/Entities/Mapper/Relation/Lazy/Initializor/IInitializor.cs b/Src/NHibernate.Envers/Entities/Mapper/Relation/Lazy/Initializor/IInitializor.cs index 33afdfea..80b2eb3f 100644 --- a/Src/NHibernate.Envers/Entities/Mapper/Relation/Lazy/Initializor/IInitializor.cs +++ b/Src/NHibernate.Envers/Entities/Mapper/Relation/Lazy/Initializor/IInitializor.cs @@ -1,6 +1,6 @@ namespace NHibernate.Envers.Entities.Mapper.Relation.Lazy.Initializor { - public interface IInitializor + public partial interface IInitializor { object Initialize(); } diff --git a/Src/NHibernate.Envers/Entities/Mapper/Relation/OneToOneNotOwningMapper.cs b/Src/NHibernate.Envers/Entities/Mapper/Relation/OneToOneNotOwningMapper.cs index 1e04d5ae..d1dbf484 100644 --- a/Src/NHibernate.Envers/Entities/Mapper/Relation/OneToOneNotOwningMapper.cs +++ b/Src/NHibernate.Envers/Entities/Mapper/Relation/OneToOneNotOwningMapper.cs @@ -5,7 +5,7 @@ namespace NHibernate.Envers.Entities.Mapper.Relation { [Serializable] - public class OneToOneNotOwningMapper : AbstractOneToOneMapper + public partial class OneToOneNotOwningMapper : AbstractOneToOneMapper { private readonly string _owningReferencePropertyName; diff --git a/Src/NHibernate.Envers/Entities/Mapper/Relation/OneToOnePrimaryKeyJoinColumnMapper.cs b/Src/NHibernate.Envers/Entities/Mapper/Relation/OneToOnePrimaryKeyJoinColumnMapper.cs index 6517416a..e92d2c12 100644 --- a/Src/NHibernate.Envers/Entities/Mapper/Relation/OneToOnePrimaryKeyJoinColumnMapper.cs +++ b/Src/NHibernate.Envers/Entities/Mapper/Relation/OneToOnePrimaryKeyJoinColumnMapper.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Entities.Mapper.Relation { [Serializable] - public class OneToOnePrimaryKeyJoinColumnMapper : AbstractOneToOneMapper + public partial class OneToOnePrimaryKeyJoinColumnMapper : AbstractOneToOneMapper { public OneToOnePrimaryKeyJoinColumnMapper(string entityName, string referencedEntityName, PropertyData propertyData) : base(entityName, referencedEntityName, propertyData) diff --git a/Src/NHibernate.Envers/Entities/Mapper/Relation/ToOneEntityLoader.cs b/Src/NHibernate.Envers/Entities/Mapper/Relation/ToOneEntityLoader.cs index 12ca412e..a0b3438f 100644 --- a/Src/NHibernate.Envers/Entities/Mapper/Relation/ToOneEntityLoader.cs +++ b/Src/NHibernate.Envers/Entities/Mapper/Relation/ToOneEntityLoader.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Entities.Mapper.Relation { - public static class ToOneEntityLoader + public static partial class ToOneEntityLoader { public static object LoadImmediate(IAuditReaderImplementor versionsReader, string entityName, object entityId, long revision, bool removed, AuditConfiguration verCfg) diff --git a/Src/NHibernate.Envers/Entities/Mapper/Relation/ToOneIdMapper.cs b/Src/NHibernate.Envers/Entities/Mapper/Relation/ToOneIdMapper.cs index 38046f07..d1391ce7 100644 --- a/Src/NHibernate.Envers/Entities/Mapper/Relation/ToOneIdMapper.cs +++ b/Src/NHibernate.Envers/Entities/Mapper/Relation/ToOneIdMapper.cs @@ -11,7 +11,7 @@ namespace NHibernate.Envers.Entities.Mapper.Relation { [Serializable] - public class ToOneIdMapper : AbstractToOneMapper + public partial class ToOneIdMapper : AbstractToOneMapper { private readonly IIdMapper _delegat; private readonly string _referencedEntityName; diff --git a/Src/NHibernate.Envers/IAuditReader.cs b/Src/NHibernate.Envers/IAuditReader.cs index f0b13f1a..4d9132e4 100644 --- a/Src/NHibernate.Envers/IAuditReader.cs +++ b/Src/NHibernate.Envers/IAuditReader.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers { - public interface IAuditReader + public partial interface IAuditReader { /// /// Find an entity by primary key at the given revision. diff --git a/Src/NHibernate.Envers/ICrossTypeRevisionChangesReader.cs b/Src/NHibernate.Envers/ICrossTypeRevisionChangesReader.cs index 71204827..5b0de5e3 100644 --- a/Src/NHibernate.Envers/ICrossTypeRevisionChangesReader.cs +++ b/Src/NHibernate.Envers/ICrossTypeRevisionChangesReader.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers /// revision. Note that this API can be legally used only when default mechanism of tracking modified entity names /// is enabled. /// - public interface ICrossTypeRevisionChangesReader + public partial interface ICrossTypeRevisionChangesReader { /// /// Returns set of entity classes modified in a given revision. diff --git a/Src/NHibernate.Envers/Query/IAuditQuery.cs b/Src/NHibernate.Envers/Query/IAuditQuery.cs index e92ea70c..4c772ff0 100644 --- a/Src/NHibernate.Envers/Query/IAuditQuery.cs +++ b/Src/NHibernate.Envers/Query/IAuditQuery.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Query { - public interface IAuditQuery + public partial interface IAuditQuery { IList GetResultList(); IList GetResultList(); diff --git a/Src/NHibernate.Envers/Query/IEntityAuditQuery.cs b/Src/NHibernate.Envers/Query/IEntityAuditQuery.cs index 82fb6fa9..f7fc5470 100644 --- a/Src/NHibernate.Envers/Query/IEntityAuditQuery.cs +++ b/Src/NHibernate.Envers/Query/IEntityAuditQuery.cs @@ -11,7 +11,7 @@ namespace NHibernate.Envers.Query /// The entity type. /// No projection are allowed. /// - public interface IEntityAuditQuery where T: class + public partial interface IEntityAuditQuery where T: class { IEnumerable Results(); T Single(); diff --git a/Src/NHibernate.Envers/Query/Impl/AbstractAuditQuery.cs b/Src/NHibernate.Envers/Query/Impl/AbstractAuditQuery.cs index 3608b396..9cadc620 100644 --- a/Src/NHibernate.Envers/Query/Impl/AbstractAuditQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/AbstractAuditQuery.cs @@ -15,7 +15,7 @@ namespace NHibernate.Envers.Query.Impl { - public abstract class AbstractAuditQuery : IAuditQueryImplementor + public abstract partial class AbstractAuditQuery : IAuditQueryImplementor { private int? _maxResults; private int? _firstResult; diff --git a/Src/NHibernate.Envers/Query/Impl/AbstractRevisionsQuery.cs b/Src/NHibernate.Envers/Query/Impl/AbstractRevisionsQuery.cs index f8a055dc..e630a251 100644 --- a/Src/NHibernate.Envers/Query/Impl/AbstractRevisionsQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/AbstractRevisionsQuery.cs @@ -15,7 +15,7 @@ namespace NHibernate.Envers.Query.Impl { - public abstract class AbstractRevisionsQuery : IEntityAuditQuery where TEntity : class + public abstract partial class AbstractRevisionsQuery : IEntityAuditQuery where TEntity : class { private readonly IAuditReaderImplementor _versionsReader; private CacheMode _cacheMode; diff --git a/Src/NHibernate.Envers/Query/Impl/AllEntitiesAtRevisionQuery.cs b/Src/NHibernate.Envers/Query/Impl/AllEntitiesAtRevisionQuery.cs index 3844157a..a1928368 100644 --- a/Src/NHibernate.Envers/Query/Impl/AllEntitiesAtRevisionQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/AllEntitiesAtRevisionQuery.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Query.Impl { - public class AllEntitiesAtRevisionQuery : AbstractRevisionsQuery where TEntity : class + public partial class AllEntitiesAtRevisionQuery : AbstractRevisionsQuery where TEntity : class { private readonly long _revision; @@ -55,7 +55,8 @@ public override IEnumerable Results() AddCriterions(); // the result of BuildAndExecuteQuery is always the name-value pair of EntityMode.Map - return from versionsEntity in BuildAndExecuteQuery() + var result = BuildAndExecuteQuery(); + return from versionsEntity in result select (TEntity)EntityInstantiator.CreateInstanceFromVersionsEntity(EntityName, versionsEntity, _revision); } diff --git a/Src/NHibernate.Envers/Query/Impl/AuditAssociationQuery.cs b/Src/NHibernate.Envers/Query/Impl/AuditAssociationQuery.cs index 4d613428..1cc727e6 100644 --- a/Src/NHibernate.Envers/Query/Impl/AuditAssociationQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/AuditAssociationQuery.cs @@ -14,7 +14,7 @@ namespace NHibernate.Envers.Query.Impl { - public class AuditAssociationQuery : IAuditQueryImplementor + public partial class AuditAssociationQuery : IAuditQueryImplementor { private readonly AuditConfiguration _auditConfiguration; private readonly IAuditReaderImplementor _auditReader; diff --git a/Src/NHibernate.Envers/Query/Impl/AuditRevisionsAssociationQuery.cs b/Src/NHibernate.Envers/Query/Impl/AuditRevisionsAssociationQuery.cs index f3eb11c9..1a7bfa8b 100644 --- a/Src/NHibernate.Envers/Query/Impl/AuditRevisionsAssociationQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/AuditRevisionsAssociationQuery.cs @@ -12,7 +12,7 @@ namespace NHibernate.Envers.Query.Impl { - public class AuditRevisionsAssociationQuery : IEntityAuditQuery where TEntity : class + public partial class AuditRevisionsAssociationQuery : IEntityAuditQuery where TEntity : class { private readonly AuditConfiguration _auditConfiguration; private readonly IAuditReaderImplementor _auditReader; diff --git a/Src/NHibernate.Envers/Query/Impl/EntitiesAtRevisionQuery.cs b/Src/NHibernate.Envers/Query/Impl/EntitiesAtRevisionQuery.cs index 85c95561..0e52bb70 100644 --- a/Src/NHibernate.Envers/Query/Impl/EntitiesAtRevisionQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/EntitiesAtRevisionQuery.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Query.Impl { - public class EntitiesAtRevisionQuery : AbstractAuditQuery + public partial class EntitiesAtRevisionQuery : AbstractAuditQuery { private readonly long _revision; private readonly bool _includeDeletions; diff --git a/Src/NHibernate.Envers/Query/Impl/EntitiesModifiedAtRevisionQuery .cs b/Src/NHibernate.Envers/Query/Impl/EntitiesModifiedAtRevisionQuery .cs index 02945860..e569d03b 100644 --- a/Src/NHibernate.Envers/Query/Impl/EntitiesModifiedAtRevisionQuery .cs +++ b/Src/NHibernate.Envers/Query/Impl/EntitiesModifiedAtRevisionQuery .cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Query.Impl /// In comparison to this query returns an empty collection if an entity /// of a certain type has not been changed in a given revision. /// - public class EntitiesModifiedAtRevisionQuery : AbstractAuditQuery + public partial class EntitiesModifiedAtRevisionQuery : AbstractAuditQuery { private readonly long _revision; diff --git a/Src/NHibernate.Envers/Query/Impl/HistoryQuery.cs b/Src/NHibernate.Envers/Query/Impl/HistoryQuery.cs index ac3e5faf..7b074154 100644 --- a/Src/NHibernate.Envers/Query/Impl/HistoryQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/HistoryQuery.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Query.Impl { - public class HistoryQuery : AbstractRevisionsQuery> + public partial class HistoryQuery : AbstractRevisionsQuery> where TEntity : class where TRevisionEntity : class { @@ -33,12 +33,13 @@ ORDER BY e.revision ASC (unless another order is specified) var revisionTypePropertyName = auditEntitiesConfiguration.RevisionTypePropName; - return (from resultRow in BuildAndExecuteQuery() - let versionsEntity = (IDictionary) resultRow[0] - let revisionData = (TRevisionEntity) resultRow[1] - let revision = GetRevisionNumberFromDynamicEntity(versionsEntity) - let entity = (TEntity) EntityInstantiator.CreateInstanceFromVersionsEntity(EntityName, versionsEntity, revision) - select new RevisionEntityInfo(entity, revisionData, (RevisionType) versionsEntity[revisionTypePropertyName])); + var result = BuildAndExecuteQuery(); + return from resultRow in result + let versionsEntity = (IDictionary) resultRow[0] + let revisionData = (TRevisionEntity) resultRow[1] + let revision = GetRevisionNumberFromDynamicEntity(versionsEntity) + let entity = (TEntity) EntityInstantiator.CreateInstanceFromVersionsEntity(EntityName, versionsEntity, revision) + select new RevisionEntityInfo(entity, revisionData, (RevisionType) versionsEntity[revisionTypePropertyName]); } } } \ No newline at end of file diff --git a/Src/NHibernate.Envers/Query/Impl/RevisionsOfEntityQuery.cs b/Src/NHibernate.Envers/Query/Impl/RevisionsOfEntityQuery.cs index fa9411b3..7a584c63 100644 --- a/Src/NHibernate.Envers/Query/Impl/RevisionsOfEntityQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/RevisionsOfEntityQuery.cs @@ -8,7 +8,7 @@ namespace NHibernate.Envers.Query.Impl { - public class RevisionsOfEntityQuery : AbstractAuditQuery + public partial class RevisionsOfEntityQuery : AbstractAuditQuery { private readonly bool _selectEntitiesOnly; private readonly bool _selectDeletedEntities; diff --git a/Src/NHibernate.Envers/Query/Impl/RevisionsQuery.cs b/Src/NHibernate.Envers/Query/Impl/RevisionsQuery.cs index 5ce4b369..9bc99b7b 100644 --- a/Src/NHibernate.Envers/Query/Impl/RevisionsQuery.cs +++ b/Src/NHibernate.Envers/Query/Impl/RevisionsQuery.cs @@ -6,7 +6,7 @@ namespace NHibernate.Envers.Query.Impl { - public class RevisionsQuery : AbstractRevisionsQuery where TEntity : class + public partial class RevisionsQuery : AbstractRevisionsQuery where TEntity : class { public RevisionsQuery(AuditConfiguration auditConfiguration, IAuditReaderImplementor versionsReader, @@ -29,7 +29,8 @@ ORDER BY e.revision ASC (unless another order is specified) AddOrders(); // the result of BuildAndExecuteQuery is always the name-value pair of EntityMode.Map - return from versionsEntity in BuildAndExecuteQuery() + var result = BuildAndExecuteQuery(); + return from versionsEntity in result let revision = GetRevisionNumberFromDynamicEntity(versionsEntity) select (TEntity) EntityInstantiator.CreateInstanceFromVersionsEntity(EntityName, versionsEntity, revision); } diff --git a/Src/NHibernate.Envers/Reader/AuditReader.cs b/Src/NHibernate.Envers/Reader/AuditReader.cs index d473061d..ea65c3b0 100644 --- a/Src/NHibernate.Envers/Reader/AuditReader.cs +++ b/Src/NHibernate.Envers/Reader/AuditReader.cs @@ -11,7 +11,7 @@ namespace NHibernate.Envers.Reader { - public class AuditReader : IAuditReaderImplementor + public partial class AuditReader : IAuditReaderImplementor { private readonly AuditConfiguration verCfg; private readonly ICrossTypeRevisionChangesReader _crossTypeRevisionChangesReader; diff --git a/Src/NHibernate.Envers/Reader/CrossTypeRevisionChangesReader.cs b/Src/NHibernate.Envers/Reader/CrossTypeRevisionChangesReader.cs index 8ad7f252..7a36a3f3 100644 --- a/Src/NHibernate.Envers/Reader/CrossTypeRevisionChangesReader.cs +++ b/Src/NHibernate.Envers/Reader/CrossTypeRevisionChangesReader.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Reader { - public class CrossTypeRevisionChangesReader : ICrossTypeRevisionChangesReader + public partial class CrossTypeRevisionChangesReader : ICrossTypeRevisionChangesReader { private readonly IAuditReaderImplementor _auditReaderImplementor; private readonly AuditConfiguration _verCfg; diff --git a/Src/NHibernate.Envers/RevisionInfo/DefaultRevisionInfoGenerator.cs b/Src/NHibernate.Envers/RevisionInfo/DefaultRevisionInfoGenerator.cs index 8ccd56f2..8a536e1c 100644 --- a/Src/NHibernate.Envers/RevisionInfo/DefaultRevisionInfoGenerator.cs +++ b/Src/NHibernate.Envers/RevisionInfo/DefaultRevisionInfoGenerator.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.RevisionInfo { [Serializable] - public class DefaultRevisionInfoGenerator : IRevisionInfoGenerator + public partial class DefaultRevisionInfoGenerator : IRevisionInfoGenerator { private readonly string _revisionInfoEntityName; private readonly System.Type _revisionInfoType; diff --git a/Src/NHibernate.Envers/RevisionInfo/IRevisionInfoGenerator.cs b/Src/NHibernate.Envers/RevisionInfo/IRevisionInfoGenerator.cs index fda3de64..4fdceb07 100644 --- a/Src/NHibernate.Envers/RevisionInfo/IRevisionInfoGenerator.cs +++ b/Src/NHibernate.Envers/RevisionInfo/IRevisionInfoGenerator.cs @@ -1,6 +1,6 @@ namespace NHibernate.Envers.RevisionInfo { - public interface IRevisionInfoGenerator + public partial interface IRevisionInfoGenerator { void SaveRevisionData(ISession session, object revisionData); object Generate(); diff --git a/Src/NHibernate.Envers/Strategy/DefaultAuditStrategy.cs b/Src/NHibernate.Envers/Strategy/DefaultAuditStrategy.cs index a27f5e89..6ce1cb9f 100644 --- a/Src/NHibernate.Envers/Strategy/DefaultAuditStrategy.cs +++ b/Src/NHibernate.Envers/Strategy/DefaultAuditStrategy.cs @@ -13,7 +13,7 @@ namespace NHibernate.Envers.Strategy /// Default strategy is to simply persist the audit data. /// [Serializable] - public class DefaultAuditStrategy : IAuditStrategy + public partial class DefaultAuditStrategy : IAuditStrategy { private AuditConfiguration _auditConfiguration; diff --git a/Src/NHibernate.Envers/Strategy/IAuditStrategy.cs b/Src/NHibernate.Envers/Strategy/IAuditStrategy.cs index 12536fc4..72207585 100644 --- a/Src/NHibernate.Envers/Strategy/IAuditStrategy.cs +++ b/Src/NHibernate.Envers/Strategy/IAuditStrategy.cs @@ -10,7 +10,7 @@ namespace NHibernate.Envers.Strategy /// /// Behaviours of different audit strategy for populating audit data. /// - public interface IAuditStrategy + public partial interface IAuditStrategy { /// /// Called once at start up. diff --git a/Src/NHibernate.Envers/Strategy/ValidityAuditStrategy.cs b/Src/NHibernate.Envers/Strategy/ValidityAuditStrategy.cs index 84639b08..8dd65895 100644 --- a/Src/NHibernate.Envers/Strategy/ValidityAuditStrategy.cs +++ b/Src/NHibernate.Envers/Strategy/ValidityAuditStrategy.cs @@ -34,7 +34,7 @@ namespace NHibernate.Envers.Strategy ///

///
[Serializable] - public class ValidityAuditStrategy : IAuditStrategy + public partial class ValidityAuditStrategy : IAuditStrategy { private AuditConfiguration _auditConfiguration; diff --git a/Src/NHibernate.Envers/Synchronization/AuditProcess.cs b/Src/NHibernate.Envers/Synchronization/AuditProcess.cs index bc8644b1..caacd172 100644 --- a/Src/NHibernate.Envers/Synchronization/AuditProcess.cs +++ b/Src/NHibernate.Envers/Synchronization/AuditProcess.cs @@ -7,7 +7,7 @@ namespace NHibernate.Envers.Synchronization { - public class AuditProcess + public partial class AuditProcess { private readonly IRevisionInfoGenerator revisionInfoGenerator; private readonly ISessionImplementor session; diff --git a/Src/NHibernate.Envers/Synchronization/AuditProcessManager.cs b/Src/NHibernate.Envers/Synchronization/AuditProcessManager.cs index 8a2cd654..a1fb1bfd 100644 --- a/Src/NHibernate.Envers/Synchronization/AuditProcessManager.cs +++ b/Src/NHibernate.Envers/Synchronization/AuditProcessManager.cs @@ -62,10 +62,12 @@ public void ExecuteAfterTransactionCompletion(bool success) _auditProcesses.Remove(_transaction); } - public Task ExecuteBeforeTransactionCompletionAsync(CancellationToken cancellationToken) + public async Task ExecuteBeforeTransactionCompletionAsync(CancellationToken cancellationToken) { - ExecuteBeforeTransactionCompletion(); - return Task.CompletedTask; + if (_auditProcesses.TryGetValue(_transaction, out var currentProcess)) + { + await currentProcess.DoBeforeTransactionCompletionAsync(cancellationToken).ConfigureAwait(false); + } } public Task ExecuteAfterTransactionCompletionAsync(bool success, CancellationToken cancellationToken) diff --git a/Src/NHibernate.Envers/Synchronization/Work/AbstractAuditWorkUnit.cs b/Src/NHibernate.Envers/Synchronization/Work/AbstractAuditWorkUnit.cs index cb442137..c2bb9f74 100644 --- a/Src/NHibernate.Envers/Synchronization/Work/AbstractAuditWorkUnit.cs +++ b/Src/NHibernate.Envers/Synchronization/Work/AbstractAuditWorkUnit.cs @@ -4,7 +4,7 @@ namespace NHibernate.Envers.Synchronization.Work { - public abstract class AbstractAuditWorkUnit : IAuditWorkUnit + public abstract partial class AbstractAuditWorkUnit : IAuditWorkUnit { private object _performedData; diff --git a/Src/NHibernate.Envers/Synchronization/Work/IAuditWorkUnit.cs b/Src/NHibernate.Envers/Synchronization/Work/IAuditWorkUnit.cs index 445fbdb1..947abfb1 100644 --- a/Src/NHibernate.Envers/Synchronization/Work/IAuditWorkUnit.cs +++ b/Src/NHibernate.Envers/Synchronization/Work/IAuditWorkUnit.cs @@ -2,7 +2,7 @@ namespace NHibernate.Envers.Synchronization.Work { - public interface IAuditWorkUnit: IWorkUnitMergeVisitor, IWorkUnitMergeDispatcher + public partial interface IAuditWorkUnit: IWorkUnitMergeVisitor, IWorkUnitMergeDispatcher { object EntityId { get; } string EntityName { get; } diff --git a/Src/NHibernate.Envers/Synchronization/Work/PersistentCollectionChangeWorkUnit.cs b/Src/NHibernate.Envers/Synchronization/Work/PersistentCollectionChangeWorkUnit.cs index 49ad495f..fff3ee14 100644 --- a/Src/NHibernate.Envers/Synchronization/Work/PersistentCollectionChangeWorkUnit.cs +++ b/Src/NHibernate.Envers/Synchronization/Work/PersistentCollectionChangeWorkUnit.cs @@ -9,7 +9,7 @@ namespace NHibernate.Envers.Synchronization.Work { - public class PersistentCollectionChangeWorkUnit : AbstractAuditWorkUnit + public partial class PersistentCollectionChangeWorkUnit : AbstractAuditWorkUnit { private readonly IList collectionChanges; private readonly string referencingPropertyName;