Beispiel #1
0
        public void CanUnderstandGreaterThanOrEqual()
        {
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                    .WhereGreaterThanOrEqual("Birthday", new DateTime(2010, 05, 15));

            Assert.Equal("Birthday:[20100515000000000 TO NULL]", q.ToString());
        }
Beispiel #2
0
        public void CanUnderstandLessThan()
        {
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                    .WhereLessThan("Birthday", new DateTime(2010, 05, 15));

            Assert.Equal("Birthday:{* TO 20100515000000000}", q.ToString());
        }
Beispiel #3
0
 public void CanUnderstandGreaterThanOnInt()
 {
     // should DocumentQuery<T> understand how to generate range field names?
     var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
         .WhereGreaterThan("Age_Range", 3);
     Assert.Equal("Age_Range:{0x00000003 TO NULL}", q.ToString());
 }
		public void CanUnderstandSimpleEquality()
		{
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
				.WhereEquals("Name", "ayende");

			Assert.Equal("Name:[[ayende]]", q.ToString());
		}
		public void CanUnderstandSimpleContainsWithVariable()
		{
			var ayende = "ayende" + 1;
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
				.WhereContains("Name", ayende);
			Assert.Equal("Name:ayende1", q.ToString());
		}
Beispiel #6
0
        public void CanUnderstandEqualOnDate()
        {
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                    .WhereEquals("Birthday", new DateTime(2010, 05, 15));

            Assert.Equal("Birthday:20100515000000000", q.ToString());
        }
Beispiel #7
0
        public void CanUnderstandSimpleEqualityOnInt()
        {
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                    .WhereEquals("Age", 3, false);

            Assert.Equal("Age:3", q.ToString());
        }
Beispiel #8
0
        public void CanUnderstandSimpleContains()
        {
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                    .WhereContains("Name", "ayende");

            Assert.Equal("Name:ayende", q.ToString());
        }
		public void CanUnderstandOr()
		{
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
				.WhereContains("Name", "ayende")
				.OrElse()
				.WhereContains("Email", "*****@*****.**");
			Assert.Equal("Name:ayende OR Email:[email protected]", q.ToString());
		}
Beispiel #10
0
        public void CanUnderstandSimpleContainsWithVariable()
        {
            var ayende = "ayende" + 1;
            var q      = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                         .WhereContains("Name", ayende);

            Assert.Equal("Name:ayende1", q.ToString());
        }
Beispiel #11
0
        public void CanUnderstandGreaterThanOnInt()
        {
            // should DocumentQuery<T> understand how to generate range field names?
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                    .WhereGreaterThan("Age_Range", 3);

            Assert.Equal("Age_Range:{0x00000003 TO NULL}", q.ToString());
        }
Beispiel #12
0
        public void CanUnderstandOr()
        {
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                    .WhereContains("Name", "ayende")
                    .OrElse()
                    .WhereContains("Email", "*****@*****.**");

            Assert.Equal("Name:ayende OR Email:[email protected]", q.ToString());
        }
Beispiel #13
0
        public void CanUnderstandProjectionOfSingleField()
        {
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null)
                    .WhereGreaterThanOrEqual("Birthday", new DateTime(2010, 05, 15))
                    .SelectFields <IndexedUser>("Name");
            string fields = q.ProjectionFields.Any() ?
                            "<" + String.Join(", ", q.ProjectionFields.ToArray()) + ">: " : "";

            Assert.Equal("<Name>: Birthday:[20100515000000000 TO NULL]", fields + q.ToString());
        }
		public void NoOpShouldProduceEmptyString()
		{
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null);
			Assert.Equal("", q.ToString());
		}
		public void CanUnderstandSimpleEqualityOnInt()
		{
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
				.WhereEquals("Age", 3, false);
			Assert.Equal("Age:3", q.ToString());
		}
		public void CanUnderstandProjectionOfMultipleFields()
		{
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
				.WhereGreaterThanOrEqual("Birthday", new DateTime(2010, 05, 15))
				.SelectFields<IndexedUser>("Name", "Age");
			string fields = q.ProjectionFields.Any() ?
				"<" + String.Join(", ", q.ProjectionFields.ToArray()) + ">: " : "";
			Assert.Equal("<Name, Age>: Birthday:[20100515000000000 TO NULL]", fields + q.ToString());
		}
Beispiel #17
0
        public void NoOpShouldProduceEmptyString()
        {
            var q = new DocumentQuery <IndexedUser>(null, null, "IndexName", null);

            Assert.Equal("", q.ToString());
        }
		public void CanUnderstandEqualOnDate()
		{
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
				.WhereEquals("Birthday", new DateTime(2010, 05, 15));
			Assert.Equal("Birthday:20100515000000000", q.ToString());
		}
		public void CanUnderstandLessThanOrEqual()
		{
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
				.WhereLessThanOrEqual("Birthday", new DateTime(2010, 05, 15));
			Assert.Equal("Birthday:[* TO 20100515000000000]", q.ToString());
		}
		public void CanUnderstandGreaterThan()
		{
			var q = new DocumentQuery<IndexedUser>(null, null, "IndexName", null)
				.WhereGreaterThan("Birthday", new DateTime(2010, 05, 15));
			Assert.Equal("Birthday:{20100515000000000 TO NULL}", q.ToString());
		}