Пример #1
0
        public void StrategyThrowsIfNamedObjectNotPresent()
        {
            MockBuilderContext context = CreateContext();

            context.HeadOfChain.BuildUp(context, typeof(NamedThrowingMockObject), null, null);
        }
Пример #2
0
        public void SpecifyingCreateNewAndDependencyThrows()
        {
            MockBuilderContext context = CreateContext();

            context.HeadOfChain.BuildUp(context, typeof(MockInvalidDualAttributes), null, null);
        }
        public void RequestForLogWriterWithoutSettingsThrows()
        {
            MockBuilderContext context = CreateContext(null, new DictionaryConfigurationSource());

            context.HeadOfChain.BuildUp(context, typeof(LogWriter), null, null);
        }
        public void CreationStrategyWithNoPoliciesFails()
        {
            MockBuilderContext ctx = CreateContext();

            ctx.HeadOfChain.BuildUp(ctx, typeof(object), null, null);
        }
        public void BuildUpWithNoMethodChooserRaisesNullException()
        {
            MockBuilderContext ctx = BuildContext();

            MockObject mockInstance = (MockObject)ctx.HeadOfChain.BuildUp(ctx, typeof(MockObject), null, null);
        }
 private MockBuilderContext CreateContext()
 {
     MockBuilderContext result = new MockBuilderContext();
     result.InnerChain.Add(new SingletonStrategy());
     result.InnerChain.Add(new CreationStrategy());
     return result;
 }
Пример #7
0
        public void ThrowsIfConcreteTypeToCreateCannotBeCreated()
        {
            MockBuilderContext context = CreateContext();

            context.HeadOfChain.BuildUp(context, typeof(MockDependsOnInterface), null, null);
        }
Пример #8
0
        public void SpecifyingMultipleConstructorsThrows()
        {
            MockBuilderContext context = CreateContext();

            context.HeadOfChain.BuildUp(context, typeof(MockInvalidDualConstructorAttributes), null, null);
        }
Пример #9
0
        public void CanCreateValueTypesWithConstructorInjectionStrategyInPlace()
        {
            MockBuilderContext context = CreateContext();

            Assert.AreEqual(0, context.HeadOfChain.BuildUp(context, typeof(int), null, null));
        }