コード例 #1
0
        public void NullTargetObjectName()
        {
            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            // simulate IFactoryObjectAware interface...
            Assert.Throws <ArgumentException>(() => fac.ObjectFactory = null);
        }
コード例 #2
0
		public void WhitespaceTargetObjectName()
		{
			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
			fac.TargetObjectName = string.Empty;
			// simulate IFactoryObjectAware interface...
			fac.ObjectFactory = null;
		}
コード例 #3
0
        public void NullTargetObjectName()
        {
            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            // simulate IFactoryObjectAware interface...
            fac.ObjectFactory = null;
        }
コード例 #4
0
		public void WhitespaceTargetObjectName()
		{
			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
			fac.TargetObjectName = string.Empty;
            // simulate IFactoryObjectAware interface...
            Assert.Throws<ArgumentException>(() => fac.ObjectFactory = null);
		}
コード例 #5
0
        public void WhitespaceTargetObjectName()
        {
            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = string.Empty;
            // simulate IFactoryObjectAware interface...
            fac.ObjectFactory = null;
        }
コード例 #6
0
        public void WhitespaceTargetObjectName()
        {
            ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();

            fac.TargetObjectName = string.Empty;
            // simulate IFactoryObjectAware interface...
            Assert.Throws <ArgumentException>(() => fac.ObjectFactory = null);
        }
コード例 #7
0
        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());
        }
コード例 #8
0
        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);
        }
コード例 #9
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();
        }
コード例 #10
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();
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #13
0
        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.");
        }
コード例 #14
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();
			}
		}
コード例 #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();
            }
        }
コード例 #16
0
        public void NullTargetObjectName()
		{
			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
            // simulate IFactoryObjectAware interface...
            Assert.Throws<ArgumentException>(() => fac.ObjectFactory = null);
        }
コード例 #17
0
        public void NullTargetObjectName()
		{
			ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
			// simulate IFactoryObjectAware interface...
			fac.ObjectFactory = null;
        }