System.Data.Tests.DataRowTest2.IsNull_ByName C# (CSharp) Méthode

IsNull_ByName() private méthode

private IsNull_ByName ( ) : void
Résultat void
        public void IsNull_ByName()
        {
            DataTable dt = new DataTable();
            DataColumn dc0 = new DataColumn("Col0", typeof(int));
            DataColumn dc1 = new DataColumn("Col1", typeof(int));
            dt.Columns.Add(dc0);
            dt.Columns.Add(dc1);
            dt.Rows.Add(new object[] { 1234 });
            DataRow dr = dt.Rows[0];

            #region --- assignment  ----
            // IsNull_S 1
            Assert.Equal(false, dr.IsNull("Col0"));

            // IsNull_S 2
            Assert.Equal(true, dr.IsNull("Col1"));
            #endregion

            // IsNull_S 1
            MemoryStream st = new MemoryStream();
            StreamWriter sw = new StreamWriter(st);
            sw.Write("<?xml version=\"1.0\" standalone=\"yes\"?><NewDataSet>");
            sw.Write("<Table><EmployeeNo>9</EmployeeNo></Table>");
            sw.Write("</NewDataSet>");
            sw.Flush();
            st.Position = 0;
            var ds = new DataSet();
            ds.ReadXml(st);
            //  Here we add the expression column
            ds.Tables[0].Columns.Add("ValueListValueMember", typeof(object), "EmployeeNo");

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if (row.IsNull("ValueListValueMember") == true)
                    Assert.Equal("Failed", "SubTest");
                else
                    Assert.Equal("Passed", "Passed");
            }
        }
DataRowTest2