コード例 #1
0
        public static MutateInSpecBuilder ArrayAppend <T>(this MutateInSpecBuilder builder, string path, T value, Action <MutateInArrayAppendOptions> configureOptions)
        {
            var options = new MutateInArrayAppendOptions();

            configureOptions?.Invoke(options);

            return(builder.ArrayAppend(path, value, options.CreatePath, options.XAttr));
        }
コード例 #2
0
        public static MutateInSpecBuilder <TDocument> ArrayAppend <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.ArrayAppend(SubDocumentPathExpressionVisitor.GetPath(builder, path), value, createPath));
        }