Exemple #1
0
        public void SelectAllFailConn()
        {
            setFailConn();
            ACAD food = new CADFood("GebatDataConnectionString");

            food.SelectAll();
        }
Exemple #2
0
        public void SelectAll()
        {
            ACAD      food     = new CADFood("GebatDataConnectionString");
            DataTable actual   = food.SelectAll();
            DataTable expected = this.tableFormat;
            DataRow   row      = expected.NewRow();

            row["Id"]       = 1;
            row["Name"]     = "Patates";
            row["Quantity"] = 2;
            expected.Rows.Add(row);
            DataRow row2 = expected.NewRow();

            row2["Id"]       = 2;
            row2["Name"]     = "Tomates";
            row2["Quantity"] = 3;
            expected.Rows.Add(row2);
            DataRow row3 = expected.NewRow();

            row3["Id"]       = 4;
            row3["Name"]     = "Pomes";
            row3["Quantity"] = 4;
            expected.Rows.Add(row3);
            for (int i = 0; i < expected.Rows.Count; i++)
            {
                Assert.AreEqual(expected.Rows[i]["Id"], actual.Rows[i]["Id"]);
                Assert.AreEqual(expected.Rows[i]["Name"], actual.Rows[i]["Name"]);
                Assert.AreEqual(expected.Rows[i]["Quantity"], actual.Rows[i]["Quantity"]);
            }
        }