Beispiel #1
0
        public static MutateInSpecBuilder ArrayInsert <T>(this MutateInSpecBuilder builder, string path, T value, Action <MutateInArrayInsertOptions> configureOptions)
        {
            var options = new MutateInArrayInsertOptions();

            configureOptions?.Invoke(options);

            return(builder.ArrayInsert(path, value, options.CreatePath, options.XAttr));
        }
Beispiel #2
0
        public static MutateInSpecBuilder <TDocument> ArrayInsert <TDocument, TElement>(this MutateInSpecBuilder <TDocument> builder,
                                                                                        Expression <Func <TDocument, TElement> > path, TElement value)
        {
            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            if (builder == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(builder));
            }
            if (path == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(path));
            }
            // ReSharper restore ConditionIsAlwaysTrueOrFalse

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