예제 #1
0
        public void TestOverrideGeneralAffinityRegistration()
        {
            HostServices hostServices = new HostServices();

            hostServices.SetNodeAffinity(String.Empty, NodeAffinity.InProc);
            hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
            Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
            Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project2"));
        }
예제 #2
0
        public void TestNonContradictoryAffinityAllowed()
        {
            HostServices   hostServices = new HostServices();
            TestHostObject hostObject   = new TestHostObject();

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity("project", NodeAffinity.InProc);
            Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
        }
예제 #3
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);
        }
예제 #4
0
        public void TestSpecificAffinityRegistration()
        {
            HostServices hostServices = new HostServices();

            hostServices.SetNodeAffinity("project", NodeAffinity.InProc);
            Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
            Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity("project", NodeAffinity.Any);
            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
        }
예제 #5
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"));
        }
예제 #6
0
        public void TestClearingAffinities()
        {
            HostServices hostServices = new HostServices();

            hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
            Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity(null, NodeAffinity.OutOfProc);
            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));

            hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc);
            Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity(null, NodeAffinity.OutOfProc);
            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
        }
예제 #7
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"));
        }
예제 #8
0
        public void TestDefaultAffinityWhenProjectNotRegistered()
        {
            HostServices hostServices = new HostServices();

            hostServices.SetNodeAffinity("project1", NodeAffinity.InProc);
            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project2"));
        }
예제 #9
0
        public void TestRegisterRemoteHostObjectNoAffect_Any2()
        {
            HostServices hostServices = new HostServices();

            hostServices.SetNodeAffinity("project", NodeAffinity.Any);
            hostServices.RegisterHostObject("project", "target", "task", "moniker");
            hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.Any);
        }
예제 #10
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"));
        }
예제 #11
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);
        }
예제 #12
0
 public void TestContradictoryAffinityCausesException_OutOfProc()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         HostServices hostServices = new HostServices();
         TestHostObject hostObject = new TestHostObject();
         hostServices.RegisterHostObject("project", "target", "task", hostObject);
         Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
         hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
     }
                                               );
 }
예제 #13
0
        public void TestAffinityDefaultsToAny()
        {
            HostServices hostServices = new HostServices();

            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
        }