public void TwoRecordsetsAreReturned()
        {
            var results = Connection().QueryResultsSql <ParentTestData, TestData2>(ParentTestData.Sql + TestData2.Sql);

            Assert.IsNotNull(results);
            ParentTestData.Verify(results.Set1, withGraph: false);
            TestData2.Verify(results.Set2);
        }
        public void RecordsetWithDefaultGraphIsReturned()
        {
            var results = Connection().QueryResultsSql <ParentTestDataWithDefaultGraph, TestData2>(ParentTestData.Sql + TestData2.Sql);

            Assert.IsNotNull(results);
            ParentTestData.Verify(results.Set1, withGraph: true);
            TestData2.Verify(results.Set2);
        }
        public void TestMultipleRecordsetsWithGraph()
        {
            Results <ParentTestData, TestData2> results = Connection().Dynamic().GetParentAndChildTestData(
                returns: Query.Returns(OneToOne <ParentTestData, TestData> .Records)
                .Then(Some <TestData2> .Records));

            Assert.IsNotNull(results);
            ParentTestData.Verify(results.Set1, withGraph: true);
            TestData2.Verify(results.Set2);
        }
        public void EmptyListDoesNotTerminateResults()
        {
            // expect two recordsets, first set is empty. first set should be empty, second should be full
            var results = Connection().QueryResultsSql <ParentTestData, TestData2>("SELECT 0 WHERE 0=1;" + TestData2.Sql);

            Assert.IsNotNull(results);
            Assert.IsNotNull(results.Set1);
            Assert.AreEqual(0, results.Set1.Count);
            TestData2.Verify(results.Set2);
        }
        public void TestMultipleRecordsets()
        {
            // going to infer the return type of the stored procedure rather than specifying it
            Results <ParentTestData, TestData2> results = Connection().Dynamic().GetParentAndChildTestData(
                returns: Query.Returns(Some <ParentTestData> .Records)
                .Then(Some <TestData2> .Records));

            Assert.IsNotNull(results);
            ParentTestData.Verify(results.Set1, withGraph: false);
            TestData2.Verify(results.Set2);
        }
        public void RecordsetWithGraphIsReturned()
        {
            var results = Connection().QueryResultsSql <ParentTestData, TestData2>(
                ParentTestData.Sql + TestData2.Sql,
                null,
                withGraphs: new[] { typeof(Graph <ParentTestData, TestData>) });

            Assert.IsNotNull(results);
            ParentTestData.Verify(results.Set1, withGraph: true);
            TestData2.Verify(results.Set2);
        }
        public void TestMultipleRecordsets()
        {
            using (var connection = ConnectionWithTransaction())
            {
                connection.ExecuteSql("CREATE PROC InsightTestProc (@Value varchar(128)) AS " + ParentTestData.Sql + TestData2.Sql);

                string value = "foo";

                var dc = connection.Dynamic();

                // going to infer the return type of the stored procedure rather than specifying it
                Results <ParentTestDataWithDefaultGraph, TestData2> results = dc.InsightTestProc(value, returnType: typeof(Results <ParentTestDataWithDefaultGraph, TestData2>));

                Assert.IsNotNull(results);
                ParentTestData.Verify(results.Set1, withGraph: true);
                TestData2.Verify(results.Set2);
            }
        }