示例#1
0
        public void MiddleTier_GetDataSet()
        {
            DataSet       ds        = WebServiceTests.GetDataSet();
            List <string> strErrors = new List <string>();

            if (ds == null || ds.Tables == null || ds.Tables.Count < 1 || ds.Tables[0] == null || ds.Tables[0].TableName != "table0")
            {
                strErrors.Add(string.Format("The DataTable's name in the DataSet should be {0} but returned {1}.", "table0",
                                            ds == null?"a null DataSet":ds.Tables == null?"a null DataTableCollection":ds.Tables.Count < 1?"an empty DataTableCollection":
                                            ds.Tables[0] == null?"a null DataTable":ds.Tables[0].TableName ?? "a null TableName"));
            }
            if (ds == null || ds.Tables == null || ds.Tables.Count < 1 || ds.Tables[0] == null || ds.Tables[0].Rows.Count < 1 ||
                ds.Tables[0].Rows[0]["DirtyString"].ToString() != WebServiceTests.DirtyString)
            {
                strErrors.Add(string.Format(@"The cell value in the DataSet should be {0} but returned {1}.", WebServiceTests.DirtyString,
                                            ds == null?"a null DataSet":ds.Tables == null?"a null DataTableCollection":ds.Tables.Count < 1?"an empty DataTableCollection":
                                            ds.Tables[0] == null?"a null DataTable":ds.Tables[0].Rows.Count < 1?"an empty DataRowCollection":
                                            ds.Tables[0].Rows[0]["DirtyString"] ?? "a null cell"));
            }
            Assert.IsTrue(strErrors.Count == 0);
        }