Esempio n. 1
0
        public static MutateInSpecBuilder ArrayPrepend <T>(this MutateInSpecBuilder builder, string path, T value, Action <MutateInArrayPrependOptions> configureOptions)
        {
            var options = new MutateInArrayPrependOptions();

            configureOptions?.Invoke(options);

            return(builder.ArrayPrepend(path, value, options.CreatePath, options.XAttr));
        }
Esempio n. 2
0
        public static MutateInSpecBuilder <TDocument> ArrayPrepend <TDocument, TContent, TElement>(this MutateInSpecBuilder <TDocument> builder,
                                                                                                   Expression <Func <TDocument, TContent> > path, TElement value, bool createPath = false)
            where TContent : ICollection <TElement>
        {
            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            if (builder == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(builder));
            }
            if (path == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(path));
            }
            // ReSharper restore ConditionIsAlwaysTrueOrFalse

            return((MutateInSpecBuilder <TDocument>)
                   builder.ArrayPrepend(SubDocumentPathExpressionVisitor.GetPath(builder, path), value, createPath));
        }