public void testIComponentAdapterReturnsSame()
        {
            ITouchable        touchable         = new SimpleTouchable();
            IComponentAdapter IComponentAdapter = new InstanceComponentAdapter(typeof(ITouchable), touchable);

            Assert.AreSame(touchable, IComponentAdapter.GetComponentInstance(null));
        }
Beispiel #2
0
        public IComponentAdapter RegisterComponentInstance(object componentKey, object componentInstance)
        {
            if (componentInstance == this)
            {
                throw new PicoRegistrationException(
                          "Can not register a container to itself. The container is already implicitly registered.");
            }

            IComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance);

            RegisterComponent(componentAdapter);

            return(componentAdapter);
        }
		public IComponentAdapter RegisterComponentInstance(object componentKey, object componentInstance)
		{
			if (componentInstance == this)
			{
				throw new PicoRegistrationException("Can not register a container to itself. The container is already implicitly registered.");
			}

			IComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance);

			RegisterComponent(componentAdapter);

			return componentAdapter;
		}
 public void testIComponentAdapterReturnsSame()
 {
     ITouchable touchable = new SimpleTouchable();
     IComponentAdapter IComponentAdapter = new InstanceComponentAdapter(typeof (ITouchable), touchable);
     Assert.AreSame(touchable, IComponentAdapter.GetComponentInstance(null));
 }