Exemple #1
0
        public void Test3()
        {
            var parents = new List <ParentEx>();
            var sets    = new /*[a]*/ MapResultSet /*[/a]*/[3];

            sets[0] = new MapResultSet(typeof(ParentEx), parents);
            sets[1] = new MapResultSet(typeof(ChildEx));
            sets[2] = new MapResultSet(typeof(GrandchildEx));

            using (var db = new DbManager())
            {
                db.MappingSchema = _mappingSchema;

                db
                .SetCommand(TestQuery)
                ./*[a]*/ ExecuteResultSet/*[/a]*/ (sets);
            }

            Assert.IsNotEmpty(parents);

            foreach (ParentEx parent in parents)
            {
                Assert.IsNotNull(parent);
                Assert.IsNotEmpty(parent.Children);

                foreach (ChildEx child in parent.Children)
                {
                    Assert.AreEqual(parent, child.Parent);
                    Assert.IsNotEmpty(child.Grandchildren);

                    foreach (GrandchildEx grandchild in child.Grandchildren)
                    {
                        Assert.AreEqual(child, grandchild.Child);
                        Assert.AreEqual(parent, grandchild.Child.Parent);
                    }
                }
            }
        }
		public void Test3()
		{
			var parents = new List<ParentEx>();
			var sets    = new /*[a]*/MapResultSet/*[/a]*/[3];

			sets[0] = new MapResultSet(typeof(ParentEx), parents);
			sets[1] = new MapResultSet(typeof(ChildEx));
			sets[2] = new MapResultSet(typeof(GrandchildEx));

			using (var db = new DbManager())
			{
				db.MappingSchema = _mappingSchema;

				db
					.SetCommand(TestQuery)
					./*[a]*/ExecuteResultSet/*[/a]*/(sets);
			}

			Assert.IsNotEmpty(parents);

			foreach (ParentEx parent in parents)
			{
				Assert.IsNotNull(parent);
				Assert.IsNotEmpty(parent.Children);

				foreach (ChildEx child in parent.Children)
				{
					Assert.AreEqual(parent, child.Parent);
					Assert.IsNotEmpty(child.Grandchildren);

					foreach (GrandchildEx grandchild in child.Grandchildren)
					{
						Assert.AreEqual(child, grandchild.Child);
						Assert.AreEqual(parent, grandchild.Child.Parent);
					}
				}
			}
		}