Beispiel #1
0
 public void Delete()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow del = food.GetVoidRow;
     del["Id"] = 1;
     del["Name"] = "Kg";
     food.Delete(del);
 }
Beispiel #2
0
 /// <summary>
 /// Inicializa el tipo con el nombre.
 /// </summary>
 /// <param name="name">Nombre del tipo.</param>
 public ENType(string name)
 {
     if (name == null)
     {
         throw new NullReferenceException("The name cannot be null");
     }
     cad = new CADType ("GebatDataConnectionString");
     this.name = name;
 }
Beispiel #3
0
 public void SelectWhereInvalidStart()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     food.SelectWhere("Name = 'Kg'", -3);
 }
Beispiel #4
0
        public void SelectWhereFailConn()
        {
            setFailConn();

            ACAD food = new CADType("GebatDataConnectionString");
            food.SelectWhere("Name = 'Kg'");
        }
Beispiel #5
0
 private ENType()
     : base()
 {
     cad = new CADType ("GebatDataConnectionString");
     name = "";
 }
Beispiel #6
0
 public void UpdateFailConn()
 {
     setFailConn();
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow ins = food.GetVoidRow;
     ins["Id"] = 1;
     ins["Name"] = "Cajas";
     food.Update(ins);
 }
Beispiel #7
0
 public void TestSelectOne()
 {
     string expected = "Kg";
     ACAD food = new CADType("GebatDataConnectionString");
     List<object> ids = new List<object>();
     ids.Add((int)1);
     DataRow actual = food.Select(ids);
     Assert.AreEqual(actual["Name"].ToString(), expected);
 }
Beispiel #8
0
 public void TestLast()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow actual = food.Last();
     DataRow expected = food.GetVoidRow;
     expected ["Id"] = 4;
     expected ["Name"] = "Paquetes";
     Assert.AreEqual(expected["Id"], actual["Id"]);
     Assert.AreEqual(expected["Name"], actual["Name"]);
 }
Beispiel #9
0
 public void SelectAll()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataTable actual = food.SelectAll();
     DataTable expected = this.tableFormat;
     DataRow row = expected.NewRow();
     row["Id"] = 1;
     row["Name"] = "Kg";
     expected.Rows.Add(row);
     DataRow row2 = expected.NewRow();
     row2["Id"] = 2;
     row2["Name"] = "Litros";
     expected.Rows.Add(row2);
     DataRow row3 = expected.NewRow();
     row3["Id"] = 4;
     row3["Name"] = "Paquetes";
     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"]);
     }
 }
Beispiel #10
0
        public void Select()
        {
            ACAD food = new CADType("GebatDataConnectionString");
            List<object> ids = new List<object>();
            ids.Add(1);
            DataRow actual = food.Select(ids);
            DataTable table = tableFormat;
            DataRow expected = table.NewRow();
            expected["Id"] = 1;
            expected["Name"] = "Kg";

            Assert.AreEqual(expected["Id"], actual["Id"]);
            Assert.AreEqual(expected["Name"], actual["Name"]);
        }
Beispiel #11
0
 public void InsertNullRow()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow ins = null;
     food.Insert(ins);
 }
Beispiel #12
0
 public void InsertFailCOnn()
 {
     setFailConn();
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow ins = food.GetVoidRow;
     ins["Name"] = "Cajas";
     food.Insert(ins);
 }
Beispiel #13
0
 public void Insert()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow ins = food.GetVoidRow;
     ins["Name"] = "Cajas";
     DataRow expected = food.GetVoidRow;
     expected ["Id"] = 5;
     expected ["Name"] = "Cajas";
     DataRow actual = food.Insert(ins);
     Assert.AreEqual(expected["Id"], actual["Id"]);
     Assert.AreEqual(expected["Name"], actual["Name"]);
 }
Beispiel #14
0
 public void DeleteWrongRow()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow del = food.GetVoidRow;
     del["Name"] = new ENType("taca");
     food.Delete(del);
 }
Beispiel #15
0
 public void DeleteNullRow()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     food.Delete(null);
 }
Beispiel #16
0
 public void SelectWjereInvalidStatement()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     food.SelectWhere("Name = ; ");
 }
Beispiel #17
0
 public void TestCount()
 {
     int expected = 3;
     ACAD food = new CADType("GebatDataConnectionString");
     int actual = food.Count();
     Assert.AreEqual(expected, actual);
 }
Beispiel #18
0
        public void SelectAllFailConn()
        {
            setFailConn();
            ACAD food = new CADType("GebatDataConnectionString");

            food.SelectAll();
        }
Beispiel #19
0
        public void TestLastConnFail()
        {
            setFailConn();
            ACAD food = new CADType("GebatDataConnectionString");

            food.Last();
        }
Beispiel #20
0
        public void SelectConnFail()
        {
            setFailConn();

            ACAD food = new CADType("GebatDataConnectionString");
            List<object> ids = new List<object>();
            ids.Add(2);
            food.Select(ids);
        }
Beispiel #21
0
 public void Update()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow mod = food.GetVoidRow;
     mod["Id"] = 1;
     mod["Name"] = "Cajas";
     food.Update(mod);
 }
Beispiel #22
0
 public void SelectInvalidNumberId()
 {
     List<object> ids = new List<object>();
     ids.Add("hola");
     ids.Add(3);
     ACAD food = new CADType("GebatDataConnectionString");
     food.Select(ids);
 }
Beispiel #23
0
 public void UpdateNullRow()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow mod = null;
     food.Update(mod);
 }
Beispiel #24
0
 public void SelectVoidList()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     food.Select(null);
 }
Beispiel #25
0
 public void DeleteFailConn()
 {
     setFailConn();
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow del = food.GetVoidRow;
     del["Id"] = 1;
     del["Name"] = "cajas";
     food.Delete(del);
 }
Beispiel #26
0
        public void SelectWhere()
        {
            ACAD food = new CADType("GebatDataConnectionString");
            DataTable expected = tableFormat;
            DataRow row = expected.NewRow();
            row["Id"] = 1;
            row["Name"] = "Kg";
            expected.Rows.Add(row);
            DataTable actual = food.SelectWhere("Name = 'Kg'");

            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"]);
            }
        }