示例#1
0
        private async Task DoInnerJoin()
        {
            var enumerable = connection.RunAsync(
                testTable.InnerJoin(
                    anotherTestTable,
                    (testObject, anotherTestObject) => testObject.Name == anotherTestObject.FirstName
                    )
                );

            Assert.That(enumerable, Is.Not.Null);

            var objects = new List <Tuple <TestObject, AnotherTestObject> >();
            var count   = 0;

            while (true)
            {
                if (!await enumerable.MoveNext())
                {
                    break;
                }
                objects.Add(enumerable.Current);
                ++count;

                var tup = enumerable.Current;
                Assert.That(tup.Item1, Is.Not.Null);
                Assert.That(tup.Item2, Is.Not.Null);
                Assert.That(tup.Item1.Name, Is.EqualTo(tup.Item2.FirstName));
            }
            Assert.That(count, Is.EqualTo(3));
            Assert.That(objects, Has.Count.EqualTo(3));
        }