public void ServiceSuccessfullyHooksEventWhenAdded()
        {
            bool     test     = false;
            WorkItem workItem = new TestableRootWorkItem();

            workItem.Services.Add(typeof(IWorkItemActivationService), new SimpleWorkItemActivationService());
            IControlActivationService service = workItem.Services.Get <IControlActivationService>();

            workItem.Activated += delegate
            {
                test = true;
            };

            UserControl view = new UserControl();

            workItem.Items.Add(view);
            service.ControlAdded(view);

            Form f = new Form();

            f.Controls.Add(view);

            f.Show();

            Assert.IsTrue(test, "Control.Enter didn't cause WorkItem.Activate to be called");
        }
        public void ContainerWorkItemIsActivated()
        {
            ActivationServiceMock activation = new ActivationServiceMock();
            WorkItem item = new TestableRootWorkItem();

            item.Services.Add(typeof(IWorkItemActivationService), activation);
            MyControl ctrl = new MyControl();

            IControlActivationService svc = item.Services.Get <IControlActivationService>();

            item.Items.Add(ctrl);
            svc.ControlAdded(ctrl);

            ctrl.FireEnter();

            Assert.AreEqual(WorkItemStatus.Active, item.Status);
        }