コード例 #1
0
		public void TearDownCallsClassWithInterface()
		{
			var strategy = new BuilderAwareStrategy();
			var context = new MockBuilderContext();
			var obj = new Aware();

			context.Strategies.Add(strategy);

		    context.ExecuteTearDown(obj);

			Assert.IsFalse(obj.OnBuiltUp__Called);
			Assert.IsTrue(obj.OnTearingDown__Called);
		}
コード例 #2
0
        public void TearDownIgnoresClassWithoutInterface()
        {
            var strategy = new BuilderAwareStrategy();
            var context = new MockBuilderContext();
            var obj = new Ignorant();

            context.Strategies.Add(strategy);

            context.ExecuteTearDown(obj);

            Assert.IsFalse(obj.OnBuiltUpWasCalled);
            Assert.IsFalse(obj.OnTearingDownWasCalled);
        }