public void NonExistantProperty()
        {
            var    constraints = new QueryConstraints <User>();
            Action actual      = () => constraints.SortBy("Arne");

            actual.ShouldThrow <ArgumentException>();
        }
示例#2
0
        public IQueryConstraints GetQueryConstraints()
        {
            var constraints = new QueryConstraints();

            if (GlasswareId.HasValue)
            {
                constraints.AddFilter("glasswareId", GlasswareId.Value);
            }
            if (StyleId.HasValue)
            {
                constraints.AddFilter("styleId", StyleId.Value);
            }
            if (AvailabilityId.HasValue)
            {
                constraints.AddFilter("availableId", AvailabilityId.Value);
            }
            if (!String.IsNullOrEmpty(Sort))
            {
                constraints.SortBy(Sort);
            }
            if (!String.IsNullOrEmpty(Order))
            {
                if (Order.ToLower().Equals("desc"))
                {
                    constraints.Descending();
                }
            }
            if (Page.HasValue)
            {
                constraints.Page(Page.Value);
            }
            return(constraints);
        }
        public void NonExistantProperty()
        {
            var constraints = new QueryConstraints<User>();
            Action actual = () => constraints.SortBy("Arne");

            actual.ShouldThrow<ArgumentException>();
        }
        public void TypedSortBy()
        {
            var constraints = new QueryConstraints <User>();

            constraints.SortBy(x => x.FirstName);

            Assert.Equal(SortOrder.Ascending, constraints.SortOrder);
            Assert.Equal("FirstName", constraints.SortPropertyName);
        }
        public void TypedSortBy()
        {
            var constraints = new QueryConstraints<User>();

            constraints.SortBy(x => x.FirstName);

            Assert.Equal(SortOrder.Ascending, constraints.SortOrder);
            Assert.Equal("FirstName", constraints.SortPropertyName);
        }
 public void NonExistantProperty()
 {
     var constraints = new QueryConstraints<User>();
     Assert.Throws<ArgumentOutOfRangeException>(() => constraints.SortBy("Arne"));
 }
示例#7
0
        public void NonExistantProperty()
        {
            var constraints = new QueryConstraints <User>();

            Assert.Throws <ArgumentOutOfRangeException>(() => constraints.SortBy("Arne"));
        }