示例#1
0
        public static MutateInSpecBuilder AddUnique <T>(this MutateInSpecBuilder builder, string path, T value, Action <MutateInArrayAddUniqueOptions> configureOptions)
        {
            var options = new MutateInArrayAddUniqueOptions();

            configureOptions?.Invoke(options);

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