Skip to content

Commit

Permalink
Generate async files
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 2, 2024
1 parent 005aa44 commit 5135f15
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/NHibernate.Test/Async/NHSpecificTest/GH3424/Fixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


using System.Collections.Generic;
using System.Linq;
using NHibernate.Linq;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.GH3424
{
using System.Threading.Tasks;
[TestFixture]
public class FixtureAsync : BugTestCase
{
protected override void OnSetUp()
{
using var session = OpenSession();
using var transaction = session.BeginTransaction();

var c1 = new Child { Name = "Rob" };
session.Save(c1);
var e1 = new Entity { Name = "Bob", Children = new HashSet<Child> { c1 } };
session.Save(e1);

transaction.Commit();
}

protected override void OnTearDown()
{
using var session = OpenSession();
using var transaction = session.BeginTransaction();
session.CreateQuery("delete Child").ExecuteUpdate();
session.CreateQuery("delete from System.Object").ExecuteUpdate();

transaction.Commit();
}

[Test]
public async Task QueryingAfterFutureThenClearAsync()
{
using var session = OpenSession();
using var transaction = session.BeginTransaction();
var futureBob = session.Query<Entity>().Where(e => e.Name == "Bob").ToFutureValue(q => q.FirstOrDefault());
var bob = await (futureBob.GetValueAsync());
Assert.That(bob, Is.Not.Null);
session.Clear();

var allQuery = session.Query<Entity>();
Assert.That(() => allQuery.ToListAsync(), Has.Count.EqualTo(1));
await (transaction.CommitAsync());
}
}
}

0 comments on commit 5135f15

Please sign in to comment.