예제 #1
0
        public void importing_services()
        {
            var builder1 = new ServiceBuilder();
            var builder2 = new ServiceBuilder();

            builder1.Add(() => "blue");
            builder2.Add(() => "green");

            builder2.Add(() => 1);

            builder2.FillInto(builder1);

            builder1.Build <string>().ShouldEqual("blue"); // not replaced
            builder1.Build <int>().ShouldEqual(1);         // was filled in
        }
        public void importing_services()
        {
            var builder1 = new ServiceBuilder();
            var builder2 = new ServiceBuilder();
        
            builder1.Add(() => "blue");
            builder2.Add(() => "green");

            builder2.Add(() => 1);

            builder2.FillInto(builder1);

            builder1.Build<string>().ShouldEqual("blue"); // not replaced
            builder1.Build<int>().ShouldEqual(1); // was filled in
        }
예제 #3
0
        public void fill_into_will_not_overwrite_the_parent_if_it_exists()
        {
            var services1 = new ServiceBuilder();
            var services2 = new ServiceBuilder();

            services1.Add<IChrome>(() => new AChrome());
            services2.Add<IChrome>(() => new BChrome());

            services2.FillInto(services1);

            services1.Build<IChrome>().ShouldBeOfType<AChrome>();
        }
예제 #4
0
        public void fill_into_will_not_overwrite_the_parent_if_it_exists()
        {
            var services1 = new ServiceBuilder();
            var services2 = new ServiceBuilder();


            services1.Add <IChrome>(() => new AChrome());
            services2.Add <IChrome>(() => new BChrome());

            services2.FillInto(services1);

            services1.Build <IChrome>().ShouldBeType <AChrome>();
        }