public void importing_test()
        {
            var b1 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            var b2 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            var b3 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            var b4 = MockRepository.GenerateMock <ITagBuilder <SecondSubject> >();
            var b5 = MockRepository.GenerateMock <ITagBuilder <SecondSubject> >();
            var b6 = MockRepository.GenerateMock <ITagBuilder <SecondSubject> >();


            var lib1 = new HtmlConventionLibrary();

            lib1.For <FakeSubject>().Add(b1);
            lib1.For <FakeSubject>().Add(b2);

            var lib2 = new HtmlConventionLibrary();

            lib2.For <FakeSubject>().Add(b3);
            lib2.For <SecondSubject>().Add(b4);
            lib2.For <SecondSubject>().Add(b5);
            lib2.For <SecondSubject>().Add(b6);

            lib1.Import(lib2);

            lib1.For <FakeSubject>().Default.Defaults.Builders.ShouldHaveTheSameElementsAs(b1, b2, b3);
            lib1.For <SecondSubject>().Default.Defaults.Builders.ShouldHaveTheSameElementsAs(b4, b5, b6);
        }
        public void for_returns_the_same_result()
        {
            var library = new HtmlConventionLibrary();
            var lib1 = library.For<FakeSubject>();
            var lib2 = library.For<FakeSubject>();

            lib1.ShouldBeTheSameAs(lib2);

            library.For<SecondSubject>().ShouldBeTheSameAs(library.For<SecondSubject>());
        }
        public void for_returns_the_same_result()
        {
            var library = new HtmlConventionLibrary();
            var lib1    = library.For <FakeSubject>();
            var lib2    = library.For <FakeSubject>();

            lib1.ShouldBeTheSameAs(lib2);


            library.For <SecondSubject>().ShouldBeTheSameAs(library.For <SecondSubject>());
        }
Beispiel #4
0
        /// <summary>
        /// Probably only useful for testing
        /// </summary>
        /// <param name="library"></param>
        /// <param name="activators"></param>
        /// <returns></returns>
        public static ElementGenerator <T> For(HtmlConventionLibrary library, IEnumerable <ITagRequestActivator> activators = null)
        {
            var tags = new TagGenerator <ElementRequest>(library.For <ElementRequest>(),
                                                         new TagRequestBuilder(activators ?? new ITagRequestActivator[0]), new ActiveProfile());

            return(new ElementGenerator <T>(tags, new InMemoryFubuRequest()));
        }
Beispiel #5
0
        public static void BuildHtmlConventionLibrary(HtmlConventionLibrary library, AccessorRules rules)
        {
            library.Import(new DefaultHtmlConventions().Library);

            var visitor = new Visitor(rules);

            library.For <ElementRequest>().AcceptVisitor(visitor);
        }
        public void importing_test()
        {
            var b1 = MockRepository.GenerateMock<ITagBuilderPolicy<FakeSubject>>();
            var b2 = MockRepository.GenerateMock<ITagBuilderPolicy<FakeSubject>>();
            var b3 = MockRepository.GenerateMock<ITagBuilderPolicy<FakeSubject>>();
            var b4 = MockRepository.GenerateMock<ITagBuilderPolicy<SecondSubject>>();
            var b5 = MockRepository.GenerateMock<ITagBuilderPolicy<SecondSubject>>();
            var b6 = MockRepository.GenerateMock<ITagBuilderPolicy<SecondSubject>>();

            var lib1 = new HtmlConventionLibrary();
            lib1.For<FakeSubject>().Add(b1);
            lib1.For<FakeSubject>().Add(b2);

            var lib2 = new HtmlConventionLibrary();
            lib2.For<FakeSubject>().Add(b3);
            lib2.For<SecondSubject>().Add(b4);
            lib2.For<SecondSubject>().Add(b5);
            lib2.For<SecondSubject>().Add(b6);

            lib1.Import(lib2);

            lib1.For<FakeSubject>().Default.Defaults.Policies.ShouldHaveTheSameElementsAs(b1, b2, b3);
            lib1.For<SecondSubject>().Default.Defaults.Policies.ShouldHaveTheSameElementsAs(b4, b5, b6);
        }
 public void Import(HtmlConventionLibrary target, HtmlConventionLibrary source)
 {
     target.For <T>().Import(source.For <T>());
 }
Beispiel #8
0
 private BuilderSet <ElementRequest> buildersFor(string category)
 {
     return(_library.For <ElementRequest>().Category(category).Profile(_profileName));
 }