Beispiel #1
0
        public void GetTargetNamesList()
        {
            int    nodeProxyId     = 1;
            string projectFileName = "ProjectFileName";

            string[] targetNames = null;

            Dictionary <string, string> dictionary = null;
            int requestId = 1;

            // Test the case where we pass in null targets
            BuildRequest buildRequest = new BuildRequest(nodeProxyId, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false);

            Assert.IsNull(buildRequest.GetTargetNamesList(), "Expected GetTargetNamesList to be null");

            // Test the case where we pass in one target
            targetNames  = new string[] { "Build" };
            buildRequest = new BuildRequest(nodeProxyId, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false);
            Assert.IsTrue(string.Compare("Build", buildRequest.GetTargetNamesList(), StringComparison.OrdinalIgnoreCase) == 0, "Expected to see Build as the targetNamesList");

            //Test the case where we pass in multiple targets
            targetNames  = new string[] { "Build", "Build2" };
            buildRequest = new BuildRequest(nodeProxyId, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false);
            Assert.IsTrue(string.Compare("Build;Build2;", buildRequest.GetTargetNamesList(), StringComparison.OrdinalIgnoreCase) == 0, "Expected to see Build;Build2; as the targetNamesList");
        }