public void TestInvalidHostObjectRegistration_NullTask() { HostServices hostServices = new HostServices(); TestHostObject hostObject = new TestHostObject(); hostServices.RegisterHostObject("project", "target", null, hostObject); }
public void TestNonContraditcoryHostObjectAllowed_InProc() { HostServices hostServices = new HostServices(); TestHostObject hostObject = new TestHostObject(); hostServices.SetNodeAffinity("project", NodeAffinity.InProc); hostServices.RegisterHostObject("project", "target", "task", hostObject); }
public void TestHostObjectCausesInProcAffinity() { HostServices hostServices = new HostServices(); TestHostObject hostObject = new TestHostObject(); hostServices.RegisterHostObject("project", "target", "task", hostObject); Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); }
public void TestContraditcoryHostObjectCausesException_OutOfProc() { HostServices hostServices = new HostServices(); TestHostObject hostObject = new TestHostObject(); hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc); hostServices.RegisterHostObject("project", "target", "task", hostObject); }
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")); }
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); }
public void TestInvalidHostObjectRegistration_NullTarget() { Assert.Throws<ArgumentNullException>(() => { HostServices hostServices = new HostServices(); TestHostObject hostObject = new TestHostObject(); hostServices.RegisterHostObject("project", null, "task", hostObject); } ); }
public void TestInvalidHostObjectRegistration_NullTask() { Assert.Throws <ArgumentNullException>(() => { HostServices hostServices = new HostServices(); TestHostObject hostObject = new TestHostObject(); hostServices.RegisterHostObject("project", "target", null, hostObject); } ); }
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); }
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); } ); }
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")); }
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")); }
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)); }
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")); }
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")); }
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")); }
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)); }
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")); }
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")); }
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")); }
public void TestHostObjectCausesInProcAffinity() { HostServices hostServices = new HostServices(); TestHostObject hostObject = new TestHostObject(); hostServices.RegisterHostObject("project", "target", "task", hostObject); Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project")); }
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")); }
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); } ); }