Пример #1
0
        public void TestInvalidHostObjectRegistration_NullTask()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.RegisterHostObject("project", "target", null, hostObject);
        }
Пример #2
0
        public void TestNonContraditcoryHostObjectAllowed_InProc()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.SetNodeAffinity("project", NodeAffinity.InProc);
            hostServices.RegisterHostObject("project", "target", "task", hostObject);
        }
Пример #3
0
        public void TestHostObjectCausesInProcAffinity()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
        }
Пример #4
0
        public void TestContraditcoryHostObjectCausesException_OutOfProc()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
            hostServices.RegisterHostObject("project", "target", "task", hostObject);
        }
Пример #5
0
        public void TestNonContraditcoryHostObjectAllowed_Any()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.SetNodeAffinity("project", NodeAffinity.Any);
            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
        }
Пример #6
0
        public void TestContradictoryAffinityCausesException_Any()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity("project", NodeAffinity.Any);
        }
Пример #7
0
 public void TestInvalidHostObjectRegistration_NullTarget()
 {
     Assert.Throws<ArgumentNullException>(() =>
     {
         HostServices hostServices = new HostServices();
         TestHostObject hostObject = new TestHostObject();
         hostServices.RegisterHostObject("project", null, "task", hostObject);
     }
    );
 }
Пример #8
0
 public void TestInvalidHostObjectRegistration_NullTask()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         HostServices hostServices = new HostServices();
         TestHostObject hostObject = new TestHostObject();
         hostServices.RegisterHostObject("project", "target", null, hostObject);
     }
                                           );
 }
Пример #9
0
        public void TestAffinityChangeAfterRegisterInprocessHostObject()
        {
            HostServices hostServices = new HostServices();

            hostServices.RegisterHostObject("project", "target", "task", "moniker");
            hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.Any);
            TestHostObject hostObject = new TestHostObject();

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.InProc);
        }
Пример #10
0
 public void TestContraditcoryHostObjectCausesException_OutOfProc()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         HostServices hostServices = new HostServices();
         TestHostObject hostObject = new TestHostObject();
         hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
         hostServices.RegisterHostObject("project", "target", "task", hostObject);
     }
                                               );
 }
Пример #11
0
        public void TestUnregisterHostObject()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.Same(hostObject, hostServices.GetHostObject("project", "target", "task"));

            hostServices.RegisterHostObject("project", "target", "task", hostObject: null);
            Assert.Null(hostServices.GetHostObject("project", "target", "task"));
        }
Пример #12
0
        public void TestAffinityChangeAfterClearingHostObject()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
            hostServices.RegisterHostObject("project", "target", "task", hostObject: null);
            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
            Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
        }
Пример #13
0
        public void UnloadedProjectDiscardsHostServicesAllProjects()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject th           = new TestHostObject();

            ProjectCollection.GlobalProjectCollection.HostServices = hostServices;
            Project project = LoadDummyProject("foo.proj");

            hostServices.RegisterHostObject(project.FullPath, "test", "Message", th);

            ProjectCollection.GlobalProjectCollection.UnloadAllProjects();

            Assert.False(hostServices.HasInProcessHostObject(project.FullPath));
        }
Пример #14
0
        public void TestValidHostObjectRegistration()
        {
            HostServices hostServices = new HostServices();
            TestHostObject hostObject = new TestHostObject();
            TestHostObject hostObject2 = new TestHostObject();
            TestHostObject hostObject3 = new TestHostObject();
            hostServices.RegisterHostObject("foo.proj", "target", "task", hostObject);
            hostServices.RegisterHostObject("foo.proj", "target2", "task", hostObject2);
            hostServices.RegisterHostObject("foo.proj", "target", "task2", hostObject3);

            Assert.AreSame(hostObject, hostServices.GetHostObject("foo.proj", "target", "task"));
            Assert.AreSame(hostObject2, hostServices.GetHostObject("foo.proj", "target2", "task"));
            Assert.AreSame(hostObject3, hostServices.GetHostObject("foo.proj", "target", "task2"));
        }
Пример #15
0
        public void TestValidHostObjectRegistration()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();
            TestHostObject hostObject2  = new TestHostObject();
            TestHostObject hostObject3  = new TestHostObject();

            hostServices.RegisterHostObject("foo.proj", "target", "task", hostObject);
            hostServices.RegisterHostObject("foo.proj", "target2", "task", hostObject2);
            hostServices.RegisterHostObject("foo.proj", "target", "task2", hostObject3);

            Assert.Same(hostObject, hostServices.GetHostObject("foo.proj", "target", "task"));
            Assert.Same(hostObject2, hostServices.GetHostObject("foo.proj", "target2", "task"));
            Assert.Same(hostObject3, hostServices.GetHostObject("foo.proj", "target", "task2"));
        }
Пример #16
0
        public void TestUnregisteringNonConflictingHostObjectRestoresOriginalAffinity()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc);
            hostServices.SetNodeAffinity("project", NodeAffinity.Any);
            Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2"));
            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
            hostServices.RegisterHostObject("project", "target", "task", hostObject: null);
            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
            Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2"));
        }
Пример #17
0
 public void TestInvalidHostObjectRegistration_NullTask()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.RegisterHostObject("project", "target", null, hostObject);
 }
Пример #18
0
        public void UnloadedProjectDiscardsHostServices()
        {
            HostServices hostServices = new HostServices();
            TestHostObject th = new TestHostObject();
            ProjectCollection.GlobalProjectCollection.HostServices = hostServices;
            Project project1 = LoadDummyProject("foo.proj");
            Project project2 = LoadDummyProject("foo.proj");

            hostServices.RegisterHostObject(project1.FullPath, "test", "Message", th);

            ProjectCollection.GlobalProjectCollection.UnloadProject(project1);

            Assert.IsTrue(hostServices.HasHostObject(project2.FullPath));

            ProjectCollection.GlobalProjectCollection.UnloadProject(project2);

            Assert.IsFalse(hostServices.HasHostObject(project2.FullPath));
        }
Пример #19
0
 public void TestAffinityChangeAfterClearingHostObject()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
     hostServices.RegisterHostObject("project", "target", "task", null);
     Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
     hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
     Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
 }
Пример #20
0
        public void TestUnregisteringNonConflictingHostObjectRestoresOriginalAffinity()
        {
            HostServices hostServices = new HostServices();
            TestHostObject hostObject = new TestHostObject();
            hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc);
            hostServices.SetNodeAffinity("project", NodeAffinity.Any);
            Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2"));
            Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
            hostServices.RegisterHostObject("project", "target", "task", null);
            Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
            Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2"));
        }
Пример #21
0
 public void TestNonContraditcoryHostObjectAllowed_InProc()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.SetNodeAffinity("project", NodeAffinity.InProc);
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
 }
Пример #22
0
 public void TestNonContraditcoryHostObjectAllowed_Any()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.SetNodeAffinity("project", NodeAffinity.Any);
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
 }
Пример #23
0
 public void TestContraditcoryHostObjectCausesException_OutOfProc()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
 }
Пример #24
0
 public void TestContradictoryAffinityCausesException_Any()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
     hostServices.SetNodeAffinity("project", NodeAffinity.Any);
 }
Пример #25
0
 public void TestHostObjectCausesInProcAffinity()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
 }
Пример #26
0
        public void TestUnregisterHostObject()
        {
            HostServices hostServices = new HostServices();
            TestHostObject hostObject = new TestHostObject();
            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.AreSame(hostObject, hostServices.GetHostObject("project", "target", "task"));

            hostServices.RegisterHostObject("project", "target", "task", null);
            Assert.IsNull(hostServices.GetHostObject("project", "target", "task"));
        }
Пример #27
0
 public void TestContraditcoryHostObjectCausesException_OutOfProc()
 {
     Assert.Throws<InvalidOperationException>(() =>
     {
         HostServices hostServices = new HostServices();
         TestHostObject hostObject = new TestHostObject();
         hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
         hostServices.RegisterHostObject("project", "target", "task", hostObject);
     }
    );
 }