public void register_and_build_by_profile()
        {
            var library = new HtmlConventionLibrary();

            library.RegisterService <IFoo, Foo>(TagConstants.Default);

            library.RegisterService <IFoo, DifferentFoo>("Profile1");

            library.Get <IFoo>("Profile1").ShouldBeOfType <DifferentFoo>();
        }
        public void if_not_explicitly_specified_assume_the_profile_is_default()
        {
            var library = new HtmlConventionLibrary();
            library.RegisterService<IFoo, Foo>(TagConstants.Default);

            library.Get<IFoo>().ShouldBeOfType<Foo>();
        }
        public void fetching_by_profile_should_fall_back_to_default_if_not_specific_implementation_is_used()
        {
            var library = new HtmlConventionLibrary();
            library.RegisterService<IFoo, Foo>(TagConstants.Default);

            library.Get<IFoo>("Profile1").ShouldBeOfType<Foo>();
        }
        public void if_not_explicitly_specified_assume_the_profile_is_default()
        {
            var library = new HtmlConventionLibrary();

            library.RegisterService <IFoo, Foo>(TagConstants.Default);

            library.Get <IFoo>().ShouldBeOfType <Foo>();
        }
        public void simple_registration_of_service_by_type()
        {
            var library = new HtmlConventionLibrary();

            library.RegisterService <IFoo, Foo>();

            library.Get <IFoo>().ShouldBeOfType <Foo>();
        }
        public void fetching_by_profile_should_fall_back_to_default_if_not_specific_implementation_is_used()
        {
            var library = new HtmlConventionLibrary();

            library.RegisterService <IFoo, Foo>(TagConstants.Default);

            library.Get <IFoo>("Profile1").ShouldBeOfType <Foo>();
        }
        public void registration_of_service_by_func()
        {
            var library = new HtmlConventionLibrary();

            library.RegisterService <IFoo>(() => new ColoredFoo {
                Color = "Red"
            });

            library.Get <IFoo>().ShouldBeOfType <ColoredFoo>()
            .Color.ShouldEqual("Red");
        }
        public void services_are_not_overwritten_while_importing()
        {
            var library1 = new HtmlConventionLibrary();
            library1.RegisterService<IFoo, LittleFoo>();

            var library2 = new HtmlConventionLibrary();
            library2.RegisterService<IFoo, BigFoo>();

            library1.Import(library2);

            library1.Get<IFoo>().ShouldBeType<LittleFoo>();
        }
        public void services_are_imported()
        {
            var library1 = new HtmlConventionLibrary();
            library1.RegisterService<IFoo, LittleFoo>();

            var library2 = new HtmlConventionLibrary();
            library2.RegisterService<IFoo, BigFoo>("different");

            library1.Import(library2);

            library1.Get<IFoo>().ShouldBeType<LittleFoo>();
            library1.Get<IFoo>("different").ShouldBeType<BigFoo>();
        }
Beispiel #10
0
        public void services_are_not_overwritten_while_importing()
        {
            var library1 = new HtmlConventionLibrary();

            library1.RegisterService <IFoo, LittleFoo>();

            var library2 = new HtmlConventionLibrary();

            library2.RegisterService <IFoo, BigFoo>();

            library1.Import(library2);

            library1.Get <IFoo>().ShouldBeOfType <LittleFoo>();
        }
Beispiel #11
0
        public void services_are_imported()
        {
            var library1 = new HtmlConventionLibrary();

            library1.RegisterService <IFoo, LittleFoo>();

            var library2 = new HtmlConventionLibrary();

            library2.RegisterService <IFoo, BigFoo>("different");

            library1.Import(library2);

            library1.Get <IFoo>().ShouldBeOfType <LittleFoo>();
            library1.Get <IFoo>("different").ShouldBeOfType <BigFoo>();
        }
        public void simple_registration_of_service_by_type()
        {
            var library = new HtmlConventionLibrary();
            library.RegisterService<IFoo, Foo>();

            library.Get<IFoo>().ShouldBeType<Foo>();
        }
        public void register_and_build_by_profile()
        {
            var library = new HtmlConventionLibrary();
            library.RegisterService<IFoo, Foo>(TagConstants.Default);

            library.RegisterService<IFoo, DifferentFoo>("Profile1");

            library.Get<IFoo>("Profile1").ShouldBeType<DifferentFoo>();
        }
        public void registration_of_service_by_func()
        {
            var library = new HtmlConventionLibrary();
            library.RegisterService<IFoo>(() => new ColoredFoo{Color = "Red"});

            library.Get<IFoo>().ShouldBeType<ColoredFoo>()
                .Color.ShouldEqual("Red");
        }
Beispiel #15
0
        //public void BuilderPolicy<T>(ITagBuilder<T> builder) where T : TagRequest
        //{

        //}

        //public void Modifier<T>(ITagModifier<T> modifier) where T : TagRequest
        //{

        //}
        public void FieldChrome <T>() where T : IFieldChrome, new()
        {
            _library.RegisterService <IFieldChrome, T>(_profileName);
        }