예제 #1
0
        public void TearDownIgnoresClassWithoutInterface()
        {
            BuilderAwareStrategy strategy = new BuilderAwareStrategy();
            MockBuilderContext   context  = new MockBuilderContext();
            Ignorant             obj      = new Ignorant();

            context.Strategies.Add(strategy);

            context.HeadOfChain.TearDown(context, obj);

            Assert.False(obj.OnBuiltUp__Called);
            Assert.False(obj.OnTearingDown__Called);
        }
예제 #2
0
        public void BuildChecksConcreteTypeAndNotRequestedType()
        {
            BuilderAwareStrategy strategy = new BuilderAwareStrategy();
            MockBuilderContext   context  = new MockBuilderContext();
            Aware obj = new Aware();

            context.Strategies.Add(strategy);

            context.HeadOfChain.BuildUp(context, typeof(Ignorant), obj);

            Assert.True(obj.OnBuiltUp__Called);
            Assert.False(obj.OnTearingDown__Called);
        }
예제 #3
0
        public void BuildCallsClassWithInterface()
        {
            BuilderAwareStrategy strategy = new BuilderAwareStrategy();
            MockBuilderContext   context  = new MockBuilderContext();
            Aware obj = new Aware();

            context.Strategies.Add(strategy);

            context.HeadOfChain.BuildUp(context, typeof(Aware), obj);

            Assert.True(obj.OnBuiltUp__Called);
            Assert.False(obj.OnTearingDown__Called);
            Assert.Equal <object>(typeof(Aware), obj.OnBuiltUp_BuildKey);
        }