PageRenderTime 26ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/src/NHibernate.Test/Async/NHSpecificTest/NH3386/Fixture.cs

https://github.com/ngbrown/nhibernate-core
C# | 71 lines | 53 code | 10 blank | 8 comment | 0 complexity | 5673e836a5d9c64030be3ee7f61d5634 MD5 | raw file
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by AsyncGenerator.
  4. //
  5. // Changes to this file may cause incorrect behavior and will be lost if
  6. // the code is regenerated.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using System.Linq;
  10. using NHibernate.Linq;
  11. using NUnit.Framework;
  12. using System;
  13. using NHibernate.SqlCommand;
  14. namespace NHibernate.Test.NHSpecificTest.NH3386
  15. {
  16. using System.Threading.Tasks;
  17. [TestFixture]
  18. public class FixtureAsync : BugTestCase
  19. {
  20. protected override bool AppliesTo(Dialect.Dialect dialect)
  21. {
  22. return dialect is Dialect.MsSql2000Dialect;
  23. }
  24. protected override void OnSetUp()
  25. {
  26. using (ISession session = OpenSession())
  27. using (ITransaction transaction = session.BeginTransaction())
  28. {
  29. var e1 = new Entity {Name = "Bob"};
  30. session.Save(e1);
  31. var e2 = new Entity {Name = "Sally"};
  32. session.Save(e2);
  33. session.Flush();
  34. transaction.Commit();
  35. }
  36. }
  37. protected override void OnTearDown()
  38. {
  39. using (ISession session = OpenSession())
  40. using (ITransaction transaction = session.BeginTransaction())
  41. {
  42. session.Delete("from System.Object");
  43. session.Flush();
  44. transaction.Commit();
  45. }
  46. }
  47. [Test]
  48. public void ShouldSupportNonRuntimeExtensionWithoutEntityReferenceAsync()
  49. {
  50. var sqlInterceptor = new SqlInterceptor();
  51. using (ISession session = OpenSession(sqlInterceptor))
  52. using (session.BeginTransaction())
  53. {
  54. var result = session.Query<Entity>()
  55. .OrderBy(e => SqlServerFunction.NewID());
  56. Assert.DoesNotThrowAsync(() => { return result.ToListAsync(); });
  57. Assert.That(sqlInterceptor.Sql.ToString(), Does.Contain(nameof(SqlServerFunction.NewID)).IgnoreCase);
  58. }
  59. }
  60. }
  61. }