public void GetAllPlaceHolders() { SqlPredicate p; p = new SqlPredicate("@PH"); Assert.That(p.GetAllPlaceHolders() , Is.EqualTo(new Dictionary <string, string> { { "PH", "" } })); p.Place("PH", "'abc' > 0"); Assert.That(p.GetAllPlaceHolders() , Is.EqualTo(new Dictionary <string, string> { { "PH", "'abc'>0" } })); p = new SqlPredicate("@PH1 And @PH2"); p.Place("PH1", "x=+100"); Assert.That(p.GetAllPlaceHolders(), Is.EqualTo(new Dictionary <string, string> { { "PH1", "x=+100" }, { "PH2", "" } })); p.Place("PH2", "y = -9"); Assert.That(p.GetAllPlaceHolders(), Is.EqualTo(new Dictionary <string, string> { { "PH1", "x=+100" }, { "PH2", "y=-9" } })); p = new SqlPredicate("@PH AND @PH"); p.Place("PH", "x = 'abc'"); Assert.That(p.GetAllPlaceHolders(), Is.EqualTo(new Dictionary <string, string> { { "PH", "x='abc'" } })); p.Place("PH", "x = 'abc'"); Assert.That(p.GetAllPlaceHolders(), Is.EqualTo(new Dictionary <string, string> { { "PH", "x='abc'" } })); }
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("")); }