public async Task CanSetResultTransformerOnFutureQueryAsync() { //NH-3222 using (var s = this.OpenSession()) using (s.BeginTransaction()) { await(s.SaveAsync(new Person("Ricardo"))); await(s.FlushAsync()); var transformer = new TestResultSetTransformer(); var l = s .CreateSQLQuery("select Name from Person") .SetResultTransformer(transformer) .Future <object[]>(); Assert.AreEqual((await(l.GetEnumerableAsync())).Count(), 1); Assert.AreEqual("Ricardo", (await(l.GetEnumerableAsync())).ElementAt(0)[0]); Assert.IsTrue(transformer.TransformListCalled); Assert.IsTrue(transformer.TransformTupleCalled); } }
public void CanSetResultTransformerOnFutureQuery() { //NH-3222 using (var s = this.OpenSession()) using (s.BeginTransaction()) { s.Save(new Person("Ricardo")); s.Flush(); var transformer = new TestResultSetTransformer(); var l = s .CreateSQLQuery("select Name from Person") .SetResultTransformer(transformer) .Future <object[]>(); Assert.AreEqual(l.Count(), 1); Assert.AreEqual("Ricardo", l.ElementAt(0)[0]); Assert.IsTrue(transformer.TransformListCalled); Assert.IsTrue(transformer.TransformTupleCalled); } }
public void CanSetResultTransformerOnFutureValue() { //NH-3222 using (var s = this.OpenSession()) using (s.BeginTransaction()) { s.Save(new Person("Ricardo")); s.Flush(); var transformer = new TestResultSetTransformer(); var l = s .CreateSQLQuery("select Name from Person") .SetResultTransformer(transformer) .FutureValue<object[]>(); var v = l.Value; Assert.AreEqual("Ricardo", v[0]); Assert.IsTrue(transformer.TransformListCalled); Assert.IsTrue(transformer.TransformTupleCalled); } }