-
Notifications
You must be signed in to change notification settings - Fork 933
Expand file tree
/
Copy pathCharComparisonTests.cs
More file actions
70 lines (63 loc) · 2.03 KB
/
Copy pathCharComparisonTests.cs
File metadata and controls
70 lines (63 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//------------------------------------------------------------------------------
// <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;
using System.Collections.Generic;
using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Linq;
using NHibernate.Mapping.ByCode;
using NUnit.Framework;
namespace NHibernate.Test.Linq
{
using System.Threading.Tasks;
using System.Threading;
[TestFixture]
public class CharEqualityTestsAsync : TestCaseMappingByCode
{
protected override HbmMapping GetMappings()
{
var mapper = new ModelMapper();
mapper.Class<Person>(ca =>
{
ca.Id(x => x.Id, map => map.Generator(Generators.Assigned));
ca.Property(x => x.Name, map => map.Length(150));
ca.Property(x => x.Type, map => map.Length(1));
});
return mapper.CompileMappingForAllExplicitlyAddedEntities();
}
protected override void OnSetUp()
{
using (ISession session = OpenSession())
using (var transaction = session.BeginTransaction())
{
session.Save(new Person { Id = 1000, Name = "Person Type A", Type = 'A' });
session.Save(new Person { Id = 1001, Name = "Person Type B", Type = 'B' });
session.Save(new Person { Id = 1002, Name = "Person Type C", Type = 'C' });
transaction.Commit();
}
}
protected override void OnTearDown()
{
using (ISession session = OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
session.Delete("from Person");
transaction.Commit();
}
}
private async Task<IList<Person>> ExecuteAsync(Func<IStatelessSession, IQueryable<Person>> query, CancellationToken cancellationToken = default(CancellationToken))
{
using (var session = Sfi.OpenStatelessSession())
using (session.BeginTransaction())
{
return await (query(session).ToListAsync(cancellationToken));
}
}
}
}