public void RegisteringExtensionTwiceThrows()
        {
            WorkItemExtensionService service = new WorkItemExtensionService();
            WorkItem wi = new TestableRootWorkItem();

            service.RegisterExtension(typeof(WorkItem), typeof(MockExtension));

            service.RegisterExtension(typeof(WorkItem), typeof(MockExtension));
        }
        public void Bug1713()
        {
            WorkItemExtensionService service = new WorkItemExtensionService();
            WorkItem wi = new TestableRootWorkItem();

            service.RegisterExtension(typeof(MyWorkItem), typeof(MockExtension));
            service.RegisterExtension(typeof(MyWorkItem), typeof(MockExtension2));

            service.RegisterExtension(typeof(MyWorkItem2), typeof(MockExtension));
            service.RegisterExtension(typeof(MyWorkItem2), typeof(MockExtension2));
        }
        public void CanRegisterExtensionForDifferentWorkItems()
        {
            WorkItemExtensionService service = new WorkItemExtensionService();
            WorkItem wi = new TestableRootWorkItem();

            service.RegisterExtension(typeof(MyWorkItem), typeof(MockExtension));
            service.RegisterExtension(typeof(MyWorkItem2), typeof(MockExtension));

            Assert.IsTrue(service.RegisteredExtensions.ContainsKey(typeof(MyWorkItem)));
            Assert.IsTrue(service.RegisteredExtensions.ContainsKey(typeof(MyWorkItem2)));
        }
        public void CanRegisterExtensionType()
        {
            WorkItemExtensionService service = new WorkItemExtensionService();

            service.RegisterExtension(typeof(WorkItem), typeof(MockExtension));

            Assert.AreEqual(1, service.RegisteredExtensions.Count);
            Assert.IsTrue(service.RegisteredExtensions.ContainsKey(typeof(WorkItem)));
        }
        public void CanInitializeExtensionsForWorkItem()
        {
            WorkItemExtensionService service = new WorkItemExtensionService();
            WorkItem wi = new TestableRootWorkItem();

            service.RegisterExtension(typeof(WorkItem), typeof(MockExtension));

            service.InitializeExtensions(wi);

            Assert.AreEqual(true, MockExtension.Initialized);
        }
        public void CreatingWorkItemInitializesExtensions()
        {
            WorkItem wi = new TestableRootWorkItem();
            WorkItemExtensionService svc = wi.Services.AddNew <WorkItemExtensionService, IWorkItemExtensionService>();

            svc.RegisterExtension(typeof(WorkItem), typeof(MockExtension));

            wi.Items.AddNew <WorkItem>();

            Assert.AreEqual(true, MockExtension.Initialized);
        }
        public void VirtualMethodsAreCalled()
        {
            IWorkItemExtensionService extensions = new WorkItemExtensionService();
            WorkItem parentWorkItem = new TestableRootWorkItem();

            parentWorkItem.Services.Add(typeof(IWorkItemActivationService), new SimpleWorkItemActivationService());
            parentWorkItem.Services.Add(typeof(IWorkItemExtensionService), extensions);
            extensions.RegisterExtension(typeof(WorkItem), typeof(MockExtension));

            WorkItem childWorkItem = parentWorkItem.WorkItems.AddNew <WorkItem>();

            childWorkItem.Activate();
            childWorkItem.Run();
            childWorkItem.Deactivate();
            childWorkItem.Terminate();

            Assert.IsTrue(MockExtension.InitializedCalled);
            Assert.IsTrue(MockExtension.ActivatedCalled);
            Assert.IsTrue(MockExtension.DeactivatedCalled);
            Assert.IsTrue(MockExtension.RunStartedCalled);
            Assert.IsTrue(MockExtension.TerminatedCalled);
        }
        public void ThrowsIfExtensionTypeIsNotIWorkItemExtension()
        {
            WorkItemExtensionService service = new WorkItemExtensionService();

            service.RegisterExtension(typeof(WorkItem), typeof(object));
        }
        public void NullExtensionTypeThrows()
        {
            WorkItemExtensionService service = new WorkItemExtensionService();

            service.RegisterExtension(typeof(WorkItem), null);
        }
Exemplo n.º 10
0
        public void NullWorkItemTypeThrows()
        {
            WorkItemExtensionService service = new WorkItemExtensionService();

            service.RegisterExtension(null, typeof(MockExtension));
        }