Example #1
0
        public void StaticHandlerThrows()
        {
            CommandStrategy    strategy = new CommandStrategy();
            MockBuilderContext context  = new MockBuilderContext(strategy);
            WorkItem           wi       = new TestableRootWorkItem();

            context.Locator.Add(new DependencyResolutionLocatorKey(typeof(WorkItem), null), wi);

            SampleStaticClass sample = new SampleStaticClass();

            strategy.BuildUp(context, typeof(SampleStaticClass), sample, null);
        }
Example #2
0
        public void AddingObjectWithCommandHandlerRegisterTheCommand()
        {
            CommandStrategy    strategy = new CommandStrategy();
            MockBuilderContext context  = new MockBuilderContext(strategy);
            WorkItem           wi       = new TestableRootWorkItem();

            context.Locator.Add(new DependencyResolutionLocatorKey(typeof(WorkItem), null), wi);

            SampleClass sample = new SampleClass();

            strategy.BuildUp(context, typeof(SampleClass), sample, null);

            Assert.IsTrue(wi.Items.Contains("TestCommand"));
        }