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 TestNoContradictoryRemoteHostObjectAffinity() { HostServices hostServices = new HostServices(); hostServices.RegisterHostObject("project", "target", "task", "moniker"); hostServices.SetNodeAffinity("project", NodeAffinity.Any); }
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 TestRegisterRemoteHostObjectNoAffect_Any2() { HostServices hostServices = new HostServices(); hostServices.SetNodeAffinity("project", NodeAffinity.Any); hostServices.RegisterHostObject("project", "target", "task", "moniker"); hostServices.GetNodeAffinity("project").ShouldBe(NodeAffinity.Any); }
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_NullTask() { Assert.Throws <ArgumentNullException>(() => { HostServices hostServices = new HostServices(); TestHostObject hostObject = new TestHostObject(); hostServices.RegisterHostObject("project", "target", null, hostObject); } ); }
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); } ); }
private void SetHostObject() { HostServices services = new HostServices(); foreach (string projectName in ProjectNames) { if (projectName != null) { services.RegisterHostObject(projectName, "AfterBuild", "ScannerTask", Factory.GetScannerHost()); } } ProjectCollection.GlobalProjectCollection.HostServices = services; }
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 TestTranslationRemoteHostObjects() { var stateInHostObject = 3; var hostServices = new HostServices(); var rot = new MockRunningObjectTable(); hostServices.SetTestRunningObjectTable(rot); var moniker = nameof(TestTranslationRemoteHostObjects) + Guid.NewGuid(); var remoteHost = new MockRemoteHostObject(stateInHostObject); using (var result = rot.Register(moniker, remoteHost)) { hostServices.RegisterHostObject( "WithOutOfProc.targets", "DisplayMessages", "ATask", moniker); BuildRequest request = new BuildRequest( submissionId: 1, _nodeRequestId++, 1, new string[] { "alpha", "omega" }, hostServices: hostServices, BuildEventContext.Invalid, parentRequest: null); ((ITranslatable)request).Translate(TranslationHelpers.GetWriteTranslator()); INodePacket packet = BuildRequest.FactoryForDeserialization(TranslationHelpers.GetReadTranslator()); BuildRequest deserializedRequest = packet as BuildRequest; deserializedRequest.HostServices.SetTestRunningObjectTable(rot); var hostObject = deserializedRequest.HostServices.GetHostObject( "WithOutOfProc.targets", "DisplayMessages", "ATask") as ITestRemoteHostObject; hostObject.GetState().ShouldBe(stateInHostObject); } }