Esempio n. 1
0
        public void MiddleTier_GetTableSpecialChars()
        {
            DataTable table = WebServiceTests.GetTableSpecialChars();

            char[]        chars     = { '|', '<', '>', '&', '\'', '"', '\\', '/' };
            List <string> strErrors = new List <string>();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                for (int j = 0; j < table.Columns.Count - 1; j++)         //last column is for DirtyString
                {
                    if (table.Rows[i][j].ToString() != "cell" + i + j + chars[i * 2 + j])
                    {
                        strErrors.Add(string.Format(@"The table cell should be '{0}' but returned '{1}'.", "cell" + i + j + chars[i * 2 + j], table.Rows[i][j]));
                    }
                }
            }
            if (table.Rows[0]["DirtyString"].ToString() != WebServiceTests.DirtyString)
            {
                strErrors.Add(string.Format(@"The table cell should be '{0}' but returned '{1}'.", WebServiceTests.DirtyString, table.Rows[0]["DirtyString"]));
            }
            Assert.IsTrue(strErrors.Count == 0);
        }