Ejemplo n.º 1
0
 public void TestStringWithWildCard()
 {
     var fb = new FindFilterBuilder();
     fb.AddComment("Foo*");
     var actual = fb.ToString();
     Assert.AreEqual("where comment like 'Foo%'", actual);
 }
Ejemplo n.º 2
0
 public void TestAddBeforeDateDefault()
 {
     var fb = new FindFilterBuilder();
     fb.AddDateRange(DateTime.MinValue, new DateTime(2013, 05, 05, 0, 0, 0, DateTimeKind.Utc));
     var actual = fb.ToString();
     Assert.AreEqual("where date <= '2013-05-05T00:00:00.0000000Z'", actual);
 }
Ejemplo n.º 3
0
 public void TestSingleBranch()
 {
     var fb = new FindFilterBuilder();
     fb.AddBranch(new[] {"/main"});
     var actual = fb.ToString();
     Assert.AreEqual("where branch = '/main'", actual);
 }
Ejemplo n.º 4
0
 public void TestAddDateRange()
 {
     var fb = new FindFilterBuilder();
     fb.AddDateRange(new DateTime(2013, 05, 01, 0, 0, 0, DateTimeKind.Utc),
         new DateTime(2013, 05, 05, 0, 0, 0, DateTimeKind.Utc));
     var actual = fb.ToString();
     Assert.AreEqual("where date between '2013-05-01T00:00:00.0000000Z' and '2013-05-05T00:00:00.0000000Z'", actual);
 }
Ejemplo n.º 5
0
 public void TestMultipleProperties()
 {
     var fb = new FindFilterBuilder();
     fb.AddOwner(new[] {"sgustafsson", "jlindqvist"});
     fb.AddChangeset(new[] {2, 5, 7});
     var actual = fb.ToString();
     Assert.AreEqual(
         "where (owner = 'sgustafsson' or owner = 'jlindqvist') and (changeset = 2 or changeset = 5 or changeset = 7)",
         actual);
 }
Ejemplo n.º 6
0
 public void TestMultiplePropertiesWithRepositories()
 {
     var fb = new FindFilterBuilder();
     fb.AddChangeset(new[] {2, 5, 7});
     fb.AddDateRange(DateTime.MinValue, new DateTime(2013, 05, 05, 0, 0, 0, DateTimeKind.Utc));
     fb.AddRepositoryString(new[] {"repo1", "repo2"});
     var actual = fb.ToString();
     Assert.AreEqual(
         "where (changeset = 2 or changeset = 5 or changeset = 7) and date <= '2013-05-05T00:00:00.0000000Z' on repositories 'repo1', 'repo2'",
         actual);
 }
Ejemplo n.º 7
0
 public void TestStringWithWildCardWithRepository()
 {
     var fb = new FindFilterBuilder();
     fb.AddComment("Foo*");
     fb.AddRepositoryString(new[] {"someRepo"});
     var actual = fb.ToString();
     Assert.AreEqual("where comment like 'Foo%' on repository 'someRepo'", actual);
 }
Ejemplo n.º 8
0
 public void TestUnexpectedWildCardThrowsException()
 {
     var fb = new FindFilterBuilder();
     fb.AddBranch(new[] {"Foo*"});
 }
Ejemplo n.º 9
0
 public void TestTwoBranches()
 {
     var fb = new FindFilterBuilder();
     fb.AddBranch(new[] {"/main", "/main/dev"});
     var actual = fb.ToString();
     Assert.AreEqual("where (branch = '/main' or branch = '/main/dev')", actual);
 }