Exemple #1
0
        public void CreatedBetween_WithExclusiveFlag_UsesBraces()
        {
            //Arrange
            var builder = new ListQueyBuilder()
                          .CreatedBetween(DateTime.Parse("2001/2/3"), DateTime.Parse("2014/5/6"), false);

            //Act
            var result = builder.ToString();

            //Assert
            Assert.AreEqual("created:{2001-02-03+TO+2014-05-06}", result);
        }
Exemple #2
0
        public void CreatedBetween_WithInclusiveFlag_UsesBrackets()
        {
            //Arrange
            var builder = new ListQueyBuilder()
                          .CreatedBetween(DateTime.Parse("2000/1/1"), DateTime.Parse("2012/1/1"), true);

            //Act
            var result = builder.ToString();

            //Assert
            Assert.AreEqual("created:[2000-01-01+TO+2012-01-01]", result);
        }
Exemple #3
0
        public void MultipleFields_WithOR_MatchesExpected()
        {
            //Arrange
            var builder = new ListQueyBuilder()
                          .HasSubject("howdy neighbor")
                          .Or().HasMessage("some message here");

            //Act
            var result = builder.ToString();

            //Assert
            Assert.AreEqual("subject:howdy+neighbor+OR+message:some+message+here", result);
        }
Exemple #4
0
        public void Build_WithNoFieldBeforeChain_DontIncludeChainKeyword()
        {
            //Arrange
            var builder = new ListQueyBuilder()
                          .Chain.And()
                          .IsComplete();

            //Act
            var result = builder.ToString();

            //Assert
            Assert.AreEqual("complete:true", result); // AND is not included
        }
Exemple #5
0
        public void MultipleFields_WithAND_MatchesExpected()
        {
            //Arrange
            var builder = new ListQueyBuilder()
                          .CreatedBetween(DateTime.Parse("2000/1/1"), DateTime.Parse("2012/1/1"), true)
                          .And().IsTest();

            //Act
            var result = builder.ToString();

            //Assert
            Assert.AreEqual("created:[2000-01-01+TO+2012-01-01]+AND+test_mode:true", result);
        }
Exemple #6
0
        public void Build_WithNoFieldAfterChain_DontIncludeChainKeyword()
        {
            //Arrange
            var builder = new ListQueyBuilder()
                          .HasSubject("howdy neighbor")
                          .Or();

            //Act
            var result = builder.ToString();

            //Assert
            Assert.AreEqual("subject:howdy+neighbor", result); // OR is not included
        }
Exemple #7
0
        public void MultipleFields_WithMixedChain_MatchesExpected()
        {
            //Arrange
            var builder = new ListQueyBuilder()
                          .IsFrom("me")
                          .And().SentTo("somebody")
                          .Or().SentTo("another person");

            //Act
            var result = builder.ToString();

            //Assert
            Assert.AreEqual("from:me+AND+to:somebody+OR+to:another+person", result);
        }
Exemple #8
0
 internal QueryChain(ListQueyBuilder builder)
 {
     _builder = builder;
 }
Exemple #9
0
 public void CreatedBetween_WithReversedRange_ThrowsArgumentException()
 {
     var builder = new ListQueyBuilder()
                   .CreatedBetween(DateTime.Parse("2012/1/1"), DateTime.Parse("2000/1/1"));
 }