Example #1
0
        public void GetService()
        {
            object service;

            GetServiceContainer container = new GetServiceContainer();

            container.Add(new MyComponent());
            service = container.GetService(typeof(MyComponent));
            Assert.IsNull(service, "#1");
            service = container.GetService(typeof(Component));
            Assert.IsNull(service, "#2");
            service = container.GetService(typeof(IContainer));
            Assert.AreSame(container, service, "#3");
            service = container.GetService((Type)null);
            Assert.IsNull(service, "#4");
        }
Example #2
0
		public void GetService ()
		{
			object service;

			GetServiceContainer container = new GetServiceContainer ();
			container.Add (new MyComponent ());
			service = container.GetService (typeof (MyComponent));
			Assert.IsNull (service, "#1");
			service = container.GetService (typeof (Component));
			Assert.IsNull (service, "#2");
			service = container.GetService (typeof (IContainer));
			Assert.AreSame (container, service, "#3");
			service = container.GetService ((Type) null);
			Assert.IsNull (service, "#4");
		}