Example #1
0
        public void If_order_is_not_allowed_then_By_should_throw_api_exception()
        {
            var orders  = new Dictionary <string, OrderBy>();
            var subject = new OrderParameterBuilder <TestMetaEntity>(orders);

            Action action = () => subject.By(p => p.NotAllowedOrderMember);

            action.Should().Throw <ApiException>();
        }
Example #2
0
        public void By_with_nested_parameters_should_throw_api_exception()
        {
            var orders  = new Dictionary <string, OrderBy>();
            var subject = new OrderParameterBuilder <TestMetaEntity>(orders);

            Action action = () => subject.By(p => p.NestedEntity.StringProperty);

            action.Should().Throw <ApiException>();
        }
Example #3
0
        public void By_should_add_Order()
        {
            var orders  = new Dictionary <string, OrderBy>();
            var subject = new OrderParameterBuilder <TestMetaEntity>(orders);

            subject.By(p => p.StringProperty);

            orders.Should().HaveCount(1);
            orders["stringproperty"].Should().Be(OrderBy.Asc);
        }
Example #4
0
        public void Double_By_should_add_Order_by_two_properties()
        {
            var orders  = new Dictionary <string, OrderBy>();
            var subject = new OrderParameterBuilder <TestMetaEntity>(orders);

            subject.By(p => p.StringProperty).And.By(p => p.IntProperty, OrderBy.Desc);

            orders.Should().HaveCount(2);
            orders["stringproperty"].Should().Be(OrderBy.Asc);
            orders["intproperty"].Should().Be(OrderBy.Desc);
        }