public void AddLinkShouldThrowArgumentExceptionWhenRelIs(string rel)
        {
            Func <IHypermediaBuilder <IHypermediaDocument> > func = () => sut.AddLink(rel, TestHref);

            var exception = func.Should().Throw <ArgumentException>().Which;

            exception.Message.Should().Be("Parameter 'rel' must not be null or empty.");
            exception.ParamName.Should().BeNull();
        }
        public static IHypermediaBuilder <TDocument> AddRouteTemplate <TDocument>(this IHypermediaBuilder <TDocument> builder, string rel, string routeName)
            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(routeName))
            {
                throw new ArgumentException($"Parameter '{nameof(routeName)}' must not be null or empty.");
            }

            var link = builder.Service.GetLink(LinkRequestBuilder
                                               .CreateWithRouteName(routeName)
                                               .SetIsTemplated());

            builder.AddLink(rel, link);

            return(builder);
        }
        private static IHypermediaBuilder <TDocument> DoAddLink <TDocument>(IHypermediaBuilder <TDocument> builder, string rel, string href, string method) where TDocument : IHypermediaDocument
        {
            var link = new HttpLink(href, method);

            builder.AddLink(rel, link);

            return(builder);
        }
        private static IHypermediaBuilder <TDocument> DoAddRouteLink <TDocument>(IHypermediaBuilder <TDocument> builder, string rel, string routeName)
            where TDocument : IHypermediaDocument
        {
            var link = builder.Service.GetLink(LinkRequestBuilder
                                               .CreateWithRouteName(routeName));

            builder.AddLink(rel, link);

            return(builder);
        }
        public void AddLinkWithConditionShouldThrowArgumentExceptionWhenRelIs(string rel, bool conditionHandlerResult)
        {
            Func <IHypermediaBuilder <IHypermediaDocument> > func = () => sut.AddLink(rel, TestHref, TestMethod, doc => conditionHandlerResult);

            var exception = func.Should().Throw <ArgumentException>().Which;

            exception.Message.Should().Be("Parameter 'rel' must not be null or empty.");
            exception.ParamName.Should().BeNull();

            mockSut.Verify(x => x.AddLink(It.IsAny <string>(), It.IsAny <HttpLink>()), Times.Never);
        }