Example #1
0
        public void tag_plan_is_memoized_by_profile_and_subject()
        {
            var subject1 = new FakeSubject {
                Name = "Jeremy", Level = 10
            };
            var subject2 = new FakeSubject {
                Name = "Jeremy", Level = 10
            };

            subject1.ShouldEqual(subject2);

            theCategory.Always.Build(x => new HtmlTag("div"));
            theCategory.ForProfile("a").Always.Build(x => new HtmlTag("a"));
            theCategory.ForProfile("b").Always.Build(x => new HtmlTag("b"));



            theCategory.PlanFor(subject1).ShouldBeSameAs(theCategory.PlanFor(subject2));
            theCategory.PlanFor(subject1, "a").ShouldBeSameAs(theCategory.PlanFor(subject2, "a"));
            theCategory.PlanFor(subject1, "b").ShouldBeSameAs(theCategory.PlanFor(subject2, "b"));

            theCategory.PlanFor(subject1, "a").ShouldNotBeSameAs(theCategory.PlanFor(subject2, "b"));
            theCategory.PlanFor(subject1, "b").ShouldNotBeSameAs(theCategory.PlanFor(subject2, "a"));
        }
        public void tag_plan_is_memoized_by_profile_and_subject()
        {
            var subject1 = new FakeSubject { Name = "Jeremy", Level = 10 };
            var subject2 = new FakeSubject { Name = "Jeremy", Level = 10 };

            subject1.ShouldEqual(subject2);

            theCategory.Always.Build(x => new HtmlTag("div"));
            theCategory.ForProfile("a").Always.Build(x => new HtmlTag("a"));
            theCategory.ForProfile("b").Always.Build(x => new HtmlTag("b"));



            theCategory.PlanFor(subject1).ShouldBeSameAs(theCategory.PlanFor(subject2));
            theCategory.PlanFor(subject1, "a").ShouldBeSameAs(theCategory.PlanFor(subject2, "a"));
            theCategory.PlanFor(subject1, "b").ShouldBeSameAs(theCategory.PlanFor(subject2, "b"));

            theCategory.PlanFor(subject1, "a").ShouldNotBeSameAs(theCategory.PlanFor(subject2, "b"));
            theCategory.PlanFor(subject1, "b").ShouldNotBeSameAs(theCategory.PlanFor(subject2, "a"));
        }