public static IHypermediaBuilder <TDocument> AddLink <TDocument>(this IHypermediaBuilder <TDocument> builder, string rel, string href, string method, Func <TDocument, bool> conditionHandler)
            where TDocument : IHypermediaDocument
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (string.IsNullOrWhiteSpace(rel))
            {
                throw new ArgumentException($"Parameter '{nameof(rel)}' must not be null or empty.");
            }

            if (string.IsNullOrWhiteSpace(href))
            {
                throw new ArgumentException($"Parameter '{nameof(href)}' must not be null or empty.");
            }

            if (string.IsNullOrWhiteSpace(method))
            {
                throw new ArgumentException($"Parameter '{nameof(method)}' must not be null or empty.");
            }

            return(builder.AddLinksPerCondition(conditionHandler, b => DoAddLink(b, rel, href, method)));
        }
        public static IHypermediaBuilder <TDocument> AddRouteLink <TDocument>(this IHypermediaBuilder <TDocument> builder, string rel, string routeName, Func <TDocument, bool> conditionHandler)
            where TDocument : IHypermediaDocument
        {
            ValidateCommonParameters(builder, rel, routeName);

            return(builder.AddLinksPerCondition(conditionHandler, b => DoAddRouteLink(b, rel, routeName)));
        }
        public static IHypermediaBuilder <TDocument> AddRouteLink <TDocument>(this IHypermediaBuilder <TDocument> builder, string rel, string routeName, object routeValues, Func <TDocument, bool> conditionHandler)
            where TDocument : IHypermediaDocument
        {
            ValidateCommonParameters(builder, rel, routeName);

            if (routeValues == null)
            {
                throw new ArgumentNullException(nameof(routeValues));
            }

            return(builder.AddLinksPerCondition(conditionHandler, b => DoAddRouteLink(b, rel, routeName, routeValues)));
        }
        public void AddLinksPerConditionShouldThrowArgumentNullExceptionWhenConditionHandlerIsNull()
        {
            Func <IHypermediaBuilder <IHypermediaDocument> > func = () => sut.AddLinksPerCondition(null, builder => { });

            func.Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be("conditionHandler");
        }