Instantiate() публичный Метод

Instantiate an instance of the object described by the supplied definition from the supplied factory.
public Instantiate ( Spring.Objects.Factory.Support.RootObjectDefinition definition, string name, IObjectFactory factory ) : object
definition Spring.Objects.Factory.Support.RootObjectDefinition /// The definition of the object that is to be instantiated. ///
name string /// The name associated with the object definition. The name can be the null /// or zero length string if we're autowiring an object that doesn't belong /// to the supplied . ///
factory IObjectFactory /// The owning ///
Результат object
		public void InstantiateWithNullObjectName()
		{
			SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
			object obj = strategy.Instantiate(SingletonDefinition, null, Factory);
			Assert.IsNotNull(obj);
			Assert.IsTrue(obj is ITestObject);
			ITestObject actual = (ITestObject) obj;
			Assert.IsNull(actual.Name);
			Assert.AreEqual(0, actual.Age);
		}
        public void InstantiateWithNullObjectName()
        {
            SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
            object obj = strategy.Instantiate(SingletonDefinition, null, Factory);

            Assert.IsNotNull(obj);
            Assert.IsTrue(obj is ITestObject);
            ITestObject actual = (ITestObject)obj;

            Assert.IsNull(actual.Name);
            Assert.AreEqual(0, actual.Age);
        }
        public void InstantiateWithDefinitionThatDoesNotHaveAResolvedObjectClass()
        {
            RootObjectDefinition def = new RootObjectDefinition();

            def.ObjectTypeName = typeof(TestObject).FullName;

            SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
            object foo = strategy.Instantiate(def, "foo", Factory);

            Assert.IsNotNull(foo);
            Assert.AreEqual(typeof(TestObject), foo.GetType());
        }
        public void InstantiateWithFactoryMethod()
        {
            SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
            object obj = strategy.Instantiate(SingletonDefinitionWithFactory,
                                              string.Empty, Factory, typeof(TestObjectFactory).GetMethod("GetObject"), null);

            Assert.IsNotNull(obj);
            Assert.IsTrue(obj is ITestObject);
            ITestObject actual = (ITestObject)obj;

            Assert.AreEqual(TestObjectFactory.TheName, actual.Name);
            Assert.AreEqual(TestObjectFactory.TheAge, actual.Age);
        }
        public void InstantiateWithExplicitCtor()
        {
            SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
            object obj = strategy.Instantiate(
                SingletonDefinition, null, Factory,
                SingletonDefinition.ObjectType.GetConstructor(
                    new Type[] { typeof(string), typeof(int) }),
                new object[] { "Rick", 19 });

            Assert.IsNotNull(obj);
            Assert.IsTrue(obj is ITestObject);
            ITestObject actual = (ITestObject)obj;

            Assert.AreEqual("Rick", actual.Name);
            Assert.AreEqual(19, actual.Age);
        }
		public void InstantiateWithFactoryMethod()
		{
			SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
			object obj = strategy.Instantiate(SingletonDefinitionWithFactory,
				string.Empty, Factory, typeof (TestObjectFactory).GetMethod("GetObject"), null);
			Assert.IsNotNull(obj);
			Assert.IsTrue(obj is ITestObject);
			ITestObject actual = (ITestObject) obj;
			Assert.AreEqual(TestObjectFactory.TheName, actual.Name);
			Assert.AreEqual(TestObjectFactory.TheAge, actual.Age);
		}
		public void InstantiateWithExplicitCtor()
		{
			SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
			object obj = strategy.Instantiate(
				SingletonDefinition, null, Factory,
				SingletonDefinition.ObjectType.GetConstructor(
					new Type[] {typeof (string), typeof (int)}),
				new object[] {"Rick", 19});
			Assert.IsNotNull(obj);
			Assert.IsTrue(obj is ITestObject);
			ITestObject actual = (ITestObject) obj;
			Assert.AreEqual("Rick", actual.Name);
			Assert.AreEqual(19, actual.Age);
		}
		public void InstantiateWithNulls()
		{
			SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
            Assert.Throws<ArgumentNullException>(() => strategy.Instantiate(null, null, null));
		}
		public void InstantiateWithDefinitionThatDoesNotHaveAResolvedObjectClass()
		{
			RootObjectDefinition def = new RootObjectDefinition();
			def.ObjectTypeName = typeof(TestObject).FullName;

			SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
			object foo = strategy.Instantiate(def, "foo", Factory);
			Assert.IsNotNull(foo);
			Assert.AreEqual(typeof(TestObject), foo.GetType());
		}
		public void InstantiateWithNulls()
		{
			SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();
			strategy.Instantiate(null, null, null);
		}
        public void InstantiateWithNulls()
        {
            SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();

            strategy.Instantiate(null, null, null);
        }
        public void InstantiateWithNulls()
        {
            SimpleInstantiationStrategy strategy = new SimpleInstantiationStrategy();

            Assert.Throws <ArgumentNullException>(() => strategy.Instantiate(null, null, null));
        }