public void NameAndEstimate() {
			IAttributeDefinition estimateAttribute = new MockAttributeDefinition("Estimate");
			var query = new Query(new MockAssetType());

			query.Selection.Add(new MockAttributeDefinition("Name"));
			query.Selection.Add(estimateAttribute);
			query.OrderBy.MinorSort(estimateAttribute, OrderBy.Order.Ascending);

			var testMe = new QueryURLBuilder(query);
			Assert.AreEqual("Data/Mock?sel=Mock.Name,Mock.Estimate&sort=Mock.Estimate", testMe.ToString());
		}
        public void NameAndEstimate()
        {
            IAttributeDefinition estimateAttribute = new MockAttributeDefinition("Estimate");
            var query = new Query(new MockAssetType());

            query.Selection.Add(new MockAttributeDefinition("Name"));
            query.Selection.Add(estimateAttribute);
            query.OrderBy.MinorSort(estimateAttribute, OrderBy.Order.Ascending);

            var testMe = new QueryURLBuilder(query);

            Assert.AreEqual("Data/Mock?sel=Mock.Name,Mock.Estimate&sort=Mock.Estimate", testMe.ToString());
        }
        public void MockItemWithVariables()
        {
            var variable      = new QueryVariable("Name", "Name1", "Name2", "Name3");
            var nameAttribute = new MockAttributeDefinition("Name");

            var query = new Query(new MockAssetType());

            query.Variables.Add(variable);
            var filter = new FilterTerm(nameAttribute);

            filter.Operate(FilterTerm.Operator.Equal, variable);
            query.Filter = filter;
            query.Selection.Add(new MockAttributeDefinition("Reference"));
            var builder = new QueryURLBuilder(query);

            Assert.AreEqual("Data/Mock?sel=Mock.Reference&where=Mock.Name=$Name&with=$Name=Name1,Name2,Name3", builder.ToString());
        }
        public void DatePrecision()
        {
            var date = new DateTime(2012, 6, 21, 15, 17, 53, 504);
            var changeDateAttribute = new MockAttributeDefinition("ChangeDate");

            var query = new Query(new MockAssetType());

            query.Selection.Add(new MockAttributeDefinition("Name"));
            var filter = new FilterTerm(changeDateAttribute);

            filter.Greater(date);
            var builder = new QueryURLBuilder(query);

            query.Filter = filter;

            var queryString = builder.ToString();

            Assert.AreEqual("Data/Mock?sel=Mock.Name&where=Mock.ChangeDate>'2012-06-21T15%3a17%3a53.504'", queryString);
        }
        public void DatePrecisionInVariable()
        {
            var date = new DateTime(2012, 6, 21, 15, 17, 53, 504);
            var changeDateAttribute = new MockAttributeDefinition("ChangeDate");

            var query    = new Query(new MockAssetType());
            var variable = new QueryVariable("requestedDate", date);

            query.Selection.Add(new MockAttributeDefinition("Name"));
            query.Variables.Add(variable);
            var filter = new FilterTerm(changeDateAttribute);

            filter.Operate(FilterTerm.Operator.Equal, variable);
            var builder = new QueryURLBuilder(query);

            query.Filter = filter;

            var queryString = builder.ToString();

            Assert.AreEqual("Data/Mock?sel=Mock.Name&where=Mock.ChangeDate=$requestedDate&with=$requestedDate=2012-06-21T15%3a17%3a53.504", queryString);
        }
		public void DatePrecisionInVariable() {
			var date = new DateTime(2012, 6, 21, 15, 17, 53, 504);
			var changeDateAttribute = new MockAttributeDefinition("ChangeDate");

			var query = new Query(new MockAssetType());
			var variable = new QueryVariable("requestedDate", date);
			query.Selection.Add(new MockAttributeDefinition("Name"));
			query.Variables.Add(variable);
			var filter = new FilterTerm(changeDateAttribute);
			filter.Operate(FilterTerm.Operator.Equal, variable);
			var builder = new QueryURLBuilder(query);
			query.Filter = filter;

			var queryString = builder.ToString();
			Assert.AreEqual("Data/Mock?sel=Mock.Name&where=Mock.ChangeDate=$requestedDate&with=$requestedDate=2012-06-21T15%3a17%3a53.504", queryString);
		}
		public void DatePrecision() {
			var date = new DateTime(2012, 6, 21, 15, 17, 53, 504);
			var changeDateAttribute = new MockAttributeDefinition("ChangeDate");

			var query = new Query(new MockAssetType());
			query.Selection.Add(new MockAttributeDefinition("Name"));
			var filter = new FilterTerm(changeDateAttribute);
			filter.Greater(date);
			var builder = new QueryURLBuilder(query);
			query.Filter = filter;

			var queryString = builder.ToString();
			Assert.AreEqual("Data/Mock?sel=Mock.Name&where=Mock.ChangeDate>'2012-06-21T15%3a17%3a53.504'", queryString);
		}
		public void MockItemWithVariables() {
			var variable = new QueryVariable("Name", "Name1", "Name2", "Name3");
			var nameAttribute = new MockAttributeDefinition("Name");

			var query = new Query(new MockAssetType());
			query.Variables.Add(variable);
			var filter = new FilterTerm(nameAttribute);
			filter.Operate(FilterTerm.Operator.Equal, variable);
			query.Filter = filter;
			query.Selection.Add(new MockAttributeDefinition("Reference"));
			var builder = new QueryURLBuilder(query);
			Assert.AreEqual("Data/Mock?sel=Mock.Reference&where=Mock.Name=$Name&with=$Name=Name1,Name2,Name3", builder.ToString());
		}