public void NullTargetObjectName()
        {
            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            // simulate IFactoryObjectAware interface...
            Assert.Throws <ArgumentException>(() => fac.ObjectFactory = null);
        }
		public void WhitespaceTargetObjectName()
		{
			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
			fac.TargetObjectName = string.Empty;
			// simulate IFactoryObjectAware interface...
			fac.ObjectFactory = null;
		}
Esempio n. 3
0
        public void NullTargetObjectName()
        {
            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            // simulate IFactoryObjectAware interface...
            fac.ObjectFactory = null;
        }
		public void WhitespaceTargetObjectName()
		{
			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
			fac.TargetObjectName = string.Empty;
            // simulate IFactoryObjectAware interface...
            Assert.Throws<ArgumentException>(() => fac.ObjectFactory = null);
		}
Esempio n. 5
0
        public void WhitespaceTargetObjectName()
        {
            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = string.Empty;
            // simulate IFactoryObjectAware interface...
            fac.ObjectFactory = null;
        }
        public void WhitespaceTargetObjectName()
        {
            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = string.Empty;
            // simulate IFactoryObjectAware interface...
            Assert.Throws <ArgumentException>(() => fac.ObjectFactory = null);
        }
        public void DelegatesThroughToFactoryFor_GetObject()
        {
            A.CallTo(() => factory.ContainsObject("bojangles")).Returns(true);
            A.CallTo(() => factory.GetObject("bojangles")).Returns("Rick");

            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = "bojangles";
            fac.ObjectFactory    = factory;

            Assert.AreEqual("Rick", fac.GetObject());
        }
        public void DelegatesThroughToFactoryFor_IsSingleton()
        {
            A.CallTo(() => factory.ContainsObject("bojangles")).Returns(true);
            A.CallTo(() => factory.IsSingleton("bojangles")).Returns(true);

            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = "bojangles";
            fac.ObjectFactory    = factory;

            Assert.IsTrue(fac.IsSingleton);
        }
        public void DelegatesThroughToFactoryFor_ObjectType()
        {
            Expect.Call(factory.ContainsObject("bojangles")).Return(true);
            Expect.Call(factory.GetType("bojangles")).Return(GetType());
            mocks.ReplayAll();

            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
            fac.TargetObjectName = "bojangles";
            fac.ObjectFactory = factory;

            Assert.AreEqual(GetType(), fac.ObjectType);
            mocks.VerifyAll();
        }
        public void DelegatesThroughToFactoryFor_IsSingleton()
        {
            Expect.Call(factory.ContainsObject("bojangles")).Return(true);
            Expect.Call(factory.IsSingleton("bojangles")).Return(true);
            mocks.ReplayAll();

            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
            fac.TargetObjectName = "bojangles";
            fac.ObjectFactory = factory;

            Assert.IsTrue(fac.IsSingleton);
            mocks.VerifyAll();
        }
Esempio n. 11
0
        public void DelegatesThroughToFactoryFor_ObjectType()
        {
            Expect.Call(factory.ContainsObject("bojangles")).Return(true);
            Expect.Call(factory.GetType("bojangles")).Return(GetType());
            mocks.ReplayAll();

            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = "bojangles";
            fac.ObjectFactory    = factory;

            Assert.AreEqual(GetType(), fac.ObjectType);
            mocks.VerifyAll();
        }
Esempio n. 12
0
        public void DelegatesThroughToFactoryFor_IsSingleton()
        {
            Expect.Call(factory.ContainsObject("bojangles")).Return(true);
            Expect.Call(factory.IsSingleton("bojangles")).Return(true);
            mocks.ReplayAll();

            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = "bojangles";
            fac.ObjectFactory    = factory;

            Assert.IsTrue(fac.IsSingleton);
            mocks.VerifyAll();
        }
        public void FactoryDoesNotContainTargetObject()
        {
            A.CallTo(() => factory.ContainsObject("bojangles")).Returns(false);

            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = "bojangles";

            // simulate IFactoryObjectAware interface...
            Assert.Throws <NoSuchObjectDefinitionException>(() => fac.ObjectFactory = factory,
                                                            "Must have bailed with a " +
                                                            "NoSuchObjectDefinitionException 'cos the object doesn't " +
                                                            "exist in the associated factory.");
        }
		public void FactoryDoesNotContainTargetObject()
		{
		    Expect.Call(factory.ContainsObject("bojangles")).Return(false);
            mocks.ReplayAll();

			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
			fac.TargetObjectName = "bojangles";
			try
			{
				// simulate IFactoryObjectAware interface...
				fac.ObjectFactory = factory;
				Assert.Fail("Must have bailed with a " +
					"NoSuchObjectDefinitionException 'cos the object doesn't " +
					"exist in the associated factory.");
			}
			catch (NoSuchObjectDefinitionException)
			{
				mocks.VerifyAll();
			}
		}
Esempio n. 15
0
        public void FactoryDoesNotContainTargetObject()
        {
            Expect.Call(factory.ContainsObject("bojangles")).Return(false);
            mocks.ReplayAll();

            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = "bojangles";
            try
            {
                // simulate IFactoryObjectAware interface...
                fac.ObjectFactory = factory;
                Assert.Fail("Must have bailed with a " +
                            "NoSuchObjectDefinitionException 'cos the object doesn't " +
                            "exist in the associated factory.");
            }
            catch (NoSuchObjectDefinitionException)
            {
                mocks.VerifyAll();
            }
        }
        public void NullTargetObjectName()
		{
			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
            // simulate IFactoryObjectAware interface...
            Assert.Throws<ArgumentException>(() => fac.ObjectFactory = null);
        }
        public void NullTargetObjectName()
		{
			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
			// simulate IFactoryObjectAware interface...
			fac.ObjectFactory = null;
        }