Summary description for DefaultTemplateEngine.
Ejemplo n.º 1
0
		public void ChildKernelOverloadsParentKernel2()
		{
			var instance1 = new DefaultTemplateEngine();
			var instance2 = new DefaultTemplateEngine();

			IKernel subkernel = new DefaultKernel();
			Kernel.AddChildKernel(subkernel);

			// subkernel added first, then populated with overloaded components after

			Kernel.Register(Component.For<DefaultTemplateEngine>().Named("engine").Instance(instance2));
			Assert.AreEqual(instance2, Kernel.Resolve<DefaultTemplateEngine>("engine"));
			Assert.AreEqual(instance2, subkernel.Resolve<DefaultTemplateEngine>("engine"));

			subkernel.Register(Component.For<DefaultTemplateEngine>().Named("engine").Instance(instance1));
			Assert.AreEqual(instance1, subkernel.Resolve<DefaultTemplateEngine>("engine"));
			Assert.AreEqual(instance2, Kernel.Resolve<DefaultTemplateEngine>("engine"));
		}
Ejemplo n.º 2
0
		public void ChildKernelOverloadsParentKernel1()
		{
			var instance1 = new DefaultTemplateEngine();
			var instance2 = new DefaultTemplateEngine();

			// subkernel added with already registered components that overload parent components.

			IKernel subkernel = new DefaultKernel();
			subkernel.Register(Component.For<DefaultTemplateEngine>().Named("engine").Instance(instance1));
			Assert.AreEqual(instance1, subkernel.Resolve<DefaultTemplateEngine>("engine"));

			Kernel.Register(Component.For<DefaultTemplateEngine>().Named("engine").Instance(instance2));
			Assert.AreEqual(instance2, Kernel.Resolve<DefaultTemplateEngine>("engine"));

			Kernel.AddChildKernel(subkernel);
			Assert.AreEqual(instance1, subkernel.Resolve<DefaultTemplateEngine>("engine"));
			Assert.AreEqual(instance2, Kernel.Resolve<DefaultTemplateEngine>("engine"));
		}
		public void ChildKernelOverloadsParentKernel1()
		{
			DefaultTemplateEngine instance1 = new DefaultTemplateEngine();
			DefaultTemplateEngine instance2 = new DefaultTemplateEngine();

			// subkernel added with already registered components that overload parent components.

			IKernel subkernel = new DefaultKernel();
			subkernel.AddComponentInstance("engine", instance1);
			Assert.AreEqual(instance1, subkernel["engine"]);

			kernel.AddComponentInstance("engine", instance2);
			Assert.AreEqual(instance2, kernel["engine"]);

			kernel.AddChildKernel(subkernel);
			Assert.AreEqual(instance1, subkernel["engine"]);
			Assert.AreEqual(instance2, kernel["engine"]);
		}
		public void ChildKernelOverloadsParentKernel2()
		{
			DefaultTemplateEngine instance1 = new DefaultTemplateEngine();
			DefaultTemplateEngine instance2 = new DefaultTemplateEngine();

			IKernel subkernel = new DefaultKernel();
			kernel.AddChildKernel(subkernel);

			// subkernel added first, then populated with overloaded components after

			kernel.AddComponentInstance("engine", instance2);
			Assert.AreEqual(instance2, kernel["engine"]);
			Assert.AreEqual(instance2, subkernel["engine"]);

			subkernel.AddComponentInstance("engine", instance1);
			Assert.AreEqual(instance1, subkernel["engine"]);
			Assert.AreEqual(instance2, kernel["engine"]);
		}
 public DefaultSpamServiceWithConstructor(DefaultMailSenderService mailsender, DefaultTemplateEngine templateEngine)
 {
     this.mailSender     = mailsender;
     this.templateEngine = templateEngine;
 }