Exemplo n.º 1
0
        public void ZeroConstructorsOnValueType()
        {
            MockBuilderContext            context  = new MockBuilderContext();
            ConstructorReflectionStrategy strategy = new ConstructorReflectionStrategy();

            strategy.BuildUp(context, typeof(ZeroStruct), null);

            Assert.Null(context.Policies.Get <ICreationPolicy>(typeof(ZeroStruct)));
        }
Exemplo n.º 2
0
        public void MultipleDecoratedConstructors()
        {
            MockBuilderContext            context  = new MockBuilderContext();
            ConstructorReflectionStrategy strategy = new ConstructorReflectionStrategy();

            Assert.Throws <InvalidAttributeException>(
                delegate
            {
                strategy.BuildUp(context, typeof(MultiDecorated), null);
            });
        }
Exemplo n.º 3
0
        public void ZeroConstructorsOnReferenceType()
        {
            MockBuilderContext            context  = new MockBuilderContext();
            ConstructorReflectionStrategy strategy = new ConstructorReflectionStrategy();

            strategy.BuildUp(context, typeof(ZeroClass), null);

            ICreationPolicy policy = context.Policies.Get <ICreationPolicy>(typeof(ZeroClass));

            Assert.NotNull(policy);
            Assert.IsType <ZeroClass>(policy.Create(context, typeof(ZeroClass)));
        }
Exemplo n.º 4
0
        public void OneDecoratedConstructor()
        {
            MockBuilderContext            context  = new MockBuilderContext();
            ConstructorReflectionStrategy strategy = new ConstructorReflectionStrategy();

            strategy.BuildUp(context, typeof(Decorated), null);

            ICreationPolicy policy    = context.Policies.Get <ICreationPolicy>(typeof(Decorated));
            Decorated       decorated = Assert.IsType <Decorated>(policy.Create(context, typeof(Decorated)));

            Assert.True(decorated.Constructor__Called);
        }