Пример #1
0
        public void SqlOrder_WhenOrderByDelegateIsNull_ThrowsException()
        {
            var    fieldConfig = new FieldConfig("name");
            Action action      = () => fieldConfig.SqlOrder(null);

            action.Should()
            .Throw <ArgumentNullException>()
            .Which.ParamName.Should()
            .Be("orderBy");
        }
Пример #2
0
        public void SqlOrder_WithOrderByDelegate_AddsOrderByDelegateToMetadata()
        {
            void OrderBy(OrderByBuilder order, IReadOnlyDictionary <string, object> arguments,
                         IResolveFieldContext context, SqlTable sqlTable) => order.By("name");

            var fieldConfig = new FieldConfig("name");

            fieldConfig.SqlOrder(OrderBy);

            fieldConfig.GetMetadata <OrderByDelegate>(nameof(OrderByDelegate))
            .Should()
            .Be((OrderByDelegate)OrderBy);
        }