Exemplo n.º 1
0
        public void Empty()
        {
            SqlExpr e = new SqlExpr();

            Assert.That(e.Clone().ToString(), Is.EqualTo(""));
            Assert.That(e.GetAllPlaceHolders(), Is.EqualTo(new string[] { }));
            Assert.That(e.HasUnplacedHolder("T"), Is.False);
            Assert.That(e.HasUnplacedHolders(), Is.False);
            Assert.That(e.IsEmpty, Is.True);
            Assert.That(e.IsPlaceHolderOnly, Is.False);
            e.Place("PH", "a");
            Assert.That(e.ToString(), Is.EqualTo(""));
        }
Exemplo n.º 2
0
        public void HasUnplacedHolder()
        {
            SqlExpr e;

            e = new SqlExpr("@PH");
            Assert.That(e.HasUnplacedHolder("PH"), Is.True);
            e.Place("PH", "'abc'");
            Assert.That(e.HasUnplacedHolder("PH"), Is.False);

            e = new SqlExpr("@PH1 + @PH2");
            e.Place("PH1", "+100");
            Assert.That(e.HasUnplacedHolder("PH1"), Is.False);
            Assert.That(e.HasUnplacedHolder("PH2"), Is.True);
            e.Place("PH2", "-9");
            Assert.That(e.HasUnplacedHolder("PH1"), Is.False);
            Assert.That(e.HasUnplacedHolder("PH2"), Is.False);

            e = new SqlExpr("@PH || @PH");
            e.Place("PH", "'abc'");
            Assert.That(e.HasUnplacedHolder("PH"), Is.False);
            e.Place("PH", "'abc'");
            Assert.That(e.HasUnplacedHolder("PH"), Is.False);
        }