コード例 #1
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);
     }
                                               );
 }
コード例 #2
0
ファイル: HostServices_Tests.cs プロジェクト: enricosada/sln
        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", null);
            Assert.Equal(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
            Assert.Equal(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
        }
コード例 #3
0
        /// <summary>
        /// Creates a build request.
        /// </summary>
        private BuildRequest CreateBuildRequest(int nodeRequestId, int configId, string[] targets, NodeAffinity nodeAffinity, BuildRequest parentRequest)
        {
            HostServices hostServices = null;

            if (nodeAffinity != NodeAffinity.Any)
            {
                hostServices = new HostServices();
                hostServices.SetNodeAffinity(String.Empty, nodeAffinity);
            }

            BuildRequest request = new BuildRequest(1 /* submissionId */, nodeRequestId, configId, targets, hostServices, BuildEventContext.Invalid, parentRequest);

            return(request);
        }