Castle.MicroKernel.Tests.BestConstructorTestCase.ParametersAndServicesBestCase2 C# (CSharp) Method

ParametersAndServicesBestCase2() private method

private ParametersAndServicesBestCase2 ( ) : void
return void
		public void ParametersAndServicesBestCase2()
		{
			DefaultConfigurationStore store = new DefaultConfigurationStore();

			MutableConfiguration config = new MutableConfiguration("component");
			MutableConfiguration parameters = (MutableConfiguration)
			                                  config.Children.Add(new MutableConfiguration("parameters"));
			parameters.Children.Add(new MutableConfiguration("name", "hammett"));
			parameters.Children.Add(new MutableConfiguration("port", "120"));
			parameters.Children.Add(new MutableConfiguration("Scheduleinterval", "22"));

			store.AddComponentConfiguration("service", config);

			kernel.ConfigurationStore = store;

			kernel.AddComponent("a", typeof(A));
			kernel.AddComponent("service", typeof(ServiceUser2));

			ServiceUser2 service = (ServiceUser2) kernel["service"];

			Assert.IsNotNull(service);
			Assert.IsNotNull(service.AComponent);
			Assert.IsNull(service.BComponent);
			Assert.IsNull(service.CComponent);
			Assert.AreEqual("hammett", service.Name);
			Assert.AreEqual(120, service.Port);
			Assert.AreEqual(22, service.ScheduleInterval);
		}
	}