public void do_not_create_a_link_if_the_filter_fails()
        {
            var link = new LinkSource<Site>((t, urls) => "http://site.com")
                .IfSubjectMatches(s => false);

            link.As<ILinkSource<Site>>().LinksFor(theTarget, theUrls)
                .Any().ShouldBeFalse();
        }
Example #2
0
        public void create_a_link_if_the_filter_passes()
        {
            var link = new LinkSource<Site>((t, urls) => "http://site.com")
                .IfSubjectMatches(s => true);

            link.As<ILinkSource<Site>>().LinksFor(theTarget, theUrls)
                .Single()
                .ShouldNotBeNull();
        }
        public void do_create_a_link_if_the_filter_succeeds_by_IfEquals()
        {
            theSubject.Name = "Jeremy";

            var link = new LinkSource<Site>((t, urls) => "http://site.com")
                .IfEquals(x => x.Name, "Jeremy");

            link.As<ILinkSource<Site>>().LinksFor(theTarget, theUrls)
                .Any().ShouldBeTrue();
        }
        public void do_not_create_a_link_if_the_filter_fails_by_target_matches()
        {
            theSubject.IsObsolete = true;

            var link = new LinkSource<Site>((t, urls) => "http://site.com")
                .IfSubjectMatches(s => !s.IsObsolete);

            link.As<ILinkSource<Site>>().LinksFor(theTarget, theUrls)
                .Any().ShouldBeFalse();
        }
Example #5
0
        public void create_a_link_with_just_the_url_from_the_target()
        {
            var source = new LinkSource<Site>((t, urls) => "http://site.com");

            var link = source.As<ILinkSource<Site>>().LinksFor(theTarget, theUrls)
                .Single();

            link.Url.ShouldEqual("http://site.com");
            link.Rel.ShouldBeNull();
            link.Title.ShouldBeNull();
        }
Example #6
0
        public void create_a_link_with_just_the_url_from_the_target_with_a_title()
        {
            var token = StringToken.FromKeyString("the title");

            var source = new LinkSource<Site>((t, urls) => "http://site.com")
                .Rel("something")
                .Title(token);

            var link = source.As<ILinkSource<Site>>().LinksFor(theTarget, theUrls)
                .Single();

            link.Url.ShouldEqual("http://site.com");
            link.Title.ShouldEqual(token.ToString());
        }