System.Data.Tests.DataRowViewTest2.CreateChildView_ByName C# (CSharp) Method

CreateChildView_ByName() private method

private CreateChildView_ByName ( ) : void
return void
        public void CreateChildView_ByName()
        {
            //create a dataset with two tables, with a DataRelation between them
            DataTable dtParent = DataProvider.CreateParentDataTable();
            DataTable dtChild = DataProvider.CreateChildDataTable();
            var ds = new DataSet();
            ds.Tables.Add(dtParent);
            ds.Tables.Add(dtChild);
            DataRelation drel = new DataRelation("ParentChild", dtParent.Columns["ParentId"], dtChild.Columns["ParentId"]);
            ds.Relations.Add(drel);

            //DataView dvChild = null;
            DataView dvParent = new DataView(dtParent);

            DataView dvTmp1 = dvParent[0].CreateChildView("ParentChild");
            DataView dvTmp2 = dvParent[3].CreateChildView("ParentChild");

            // ChildView != null
            Assert.Equal(true, dvTmp1 != null);

            // Child view table = ChildTable
            Assert.Equal(dtChild, dvTmp1.Table);

            // ChildView1.Table = ChildView2.Table
            Assert.Equal(dvTmp2.Table, dvTmp1.Table);

            //the child dataview are different
            // Child DataViews different 
            Assert.Equal(false, dvTmp1.Equals(dvTmp2));
        }