System.Data.Tests.DataRowTest2.SetParentRow_ByDataRow C# (CSharp) Method

SetParentRow_ByDataRow() private method

private SetParentRow_ByDataRow ( ) : void
return void
        public void SetParentRow_ByDataRow()
        {
            DataRow drParent, drChild;
            DataRow drArrExcepted, drArrResult;
            DataTable dtChild, dtParent;
            var ds = new DataSet();
            //Create tables
            dtChild = DataProvider.CreateChildDataTable();
            dtParent = DataProvider.CreateParentDataTable();
            //Add tables to dataset
            ds.Tables.Add(dtChild);
            ds.Tables.Add(dtParent);
            //Add Relation
            DataRelation dRel = new DataRelation("Parent-Child", dtParent.Columns["ParentId"], dtChild.Columns["ParentId"]);
            ds.Relations.Add(dRel);

            drParent = dtParent.Rows[0];
            drChild = dtChild.Select("ParentId=" + drParent["ParentId"])[0];

            drChild.SetParentRow(drParent);

            //Get Excepted result
            drArrExcepted = drParent;
            //Get Result DataRowVersion.Current
            drArrResult = drChild.GetParentRow("Parent-Child", DataRowVersion.Current);

            // SetParentRow
            Assert.Equal(drArrExcepted, drArrResult);
        }
DataRowTest2