Ejemplo n.º 1
0
        public void HasUnplacedHolders()
        {
            SqlPredicate p;

            p = new SqlPredicate("@PH");
            Assert.That(p.HasUnplacedHolders(), Is.True);
            p.Place("PH", "'abc' <= 'abcd'");
            Assert.That(p.HasUnplacedHolders(), Is.False);

            p = new SqlPredicate("@PH1 And @PH2");
            p.Place("PH1", "x = +100");
            Assert.That(p.HasUnplacedHolders(), Is.True);
            p.Place("PH2", "y = -9");
            Assert.That(p.HasUnplacedHolders(), Is.False);

            p = new SqlPredicate("@PH AND @PH");
            p.Place("PH", "'abc' <= 'abcd'");
            Assert.That(p.HasUnplacedHolders(), Is.False);
            p.Place("PH", "'abc' <= 'abcd'");
            Assert.That(p.HasUnplacedHolders(), Is.False);
        }
Ejemplo n.º 2
0
        public void Empty()
        {
            SqlPredicate p = new SqlPredicate();

            Assert.That(p.And(p).ToString(), Is.EqualTo(""));
            Assert.That(p.Clone().ToString(), Is.EqualTo(""));
            Assert.That(p.GetAllPlaceHolders(), Is.EqualTo(new string[] { }));
            Assert.That(p.HasUnplacedHolder("T"), Is.False);
            Assert.That(p.HasUnplacedHolders(), Is.False);
            Assert.That(p.IsEmpty, Is.True);
            Assert.That(p.IsPlaceHolderOnly, Is.False);
            p.Place("PH", "a=1");
            Assert.That(p.ToString(), Is.EqualTo(""));
        }