Exemplo n.º 1
0
        public void FindFetch()
        {
            TesteObj obj = new TesteObj();
            obj.SetDebug(true);
            obj.ID = 1;
            obj.Nome = "teste";

            Assert.IsTrue(obj.find(), "DataObject find");
            Assert.AreEqual("SELECT Cod,Nome,Idade,PesoKg,Aniversario,Teste1,Ativo FROM TesteObj WHERE (Cod = 1) ", ((MockDriver)Conf.Driver).getPreviousCommand().CommandText, "DataObject cannot select from table");
            Assert.IsTrue(obj.fetch(), "DataObject fetch from DataReader");

            obj = new TesteObj();
            obj.Nome = "teste";
            obj.Idade = 18;
            obj.Peso = 60.5;
            obj.Ativo = true;

            Assert.IsTrue(obj.find(), "DataObject find");
            Assert.AreEqual("SELECT Cod,Nome,Idade,PesoKg,Aniversario,Teste1,Ativo FROM TesteObj WHERE (Nome LIKE 'teste') AND (Idade = 18) AND (PesoKg = 60.5) ", ((MockDriver)Conf.Driver).getPreviousCommand().CommandText, "DataObject cannot select from table");
            Assert.IsTrue(obj.fetch(), "DataObject find");
            Assert.AreEqual(1, obj.ID, "DataPool not working");

            obj = new TesteObj();
            obj.SetDebug(true);
            obj.ID = 1;

            Assert.IsTrue(obj.find(), "DataObject find");
            Assert.AreEqual("SELECT Cod,Nome,Idade,PesoKg,Aniversario,Teste1,Ativo FROM TesteObj WHERE (Cod = 1) ", ((MockDriver)Conf.Driver).getPreviousCommand().CommandText, "DataObject cannot select from table");
            Assert.IsTrue(obj.fetch(), "DataObject fetch from DataReader");
            Assert.AreEqual(60.5, obj.Peso, "DataPool not working");
        }
Exemplo n.º 2
0
 public void SetFieldError()
 {
     TesteObj obj = new TesteObj();
     obj.SetDebug(true);
     obj.ID = 1;
     obj.Nome = "teste";
     obj.SetField("Codigo", 2);
 }