Example #1
0
        public void ReadMutipleParameters()
        {
            UsingTaskParameterGroupElement parameterGroup = GetParameterGroupXml(s_contentMultipleParameters);

            Assert.NotNull(parameterGroup);
            Assert.Equal(2, parameterGroup.Count);
            Assert.NotNull(parameterGroup.Parameters);

            bool foundFirst  = false;
            bool foundSecond = false;

            foreach (ProjectUsingTaskParameterElement parameter in parameterGroup.Parameters)
            {
                if (String.Equals("MyParameter1", parameter.Name, StringComparison.OrdinalIgnoreCase))
                {
                    foundFirst = true;
                }

                if (String.Equals("MyParameter2", parameter.Name, StringComparison.OrdinalIgnoreCase))
                {
                    foundSecond = true;
                }
            }

            Assert.True(foundFirst);
            Assert.True(foundSecond);
        }
Example #2
0
        public void ReadEmptyParameterGroup()
        {
            UsingTaskParameterGroupElement parameterGroup = GetParameterGroupXml(s_contentEmptyParameterGroup);

            Assert.NotNull(parameterGroup);
            Assert.Equal(0, parameterGroup.Count);
            Assert.Null(parameterGroup.Parameters.GetEnumerator().Current);
        }
 /// <summary>
 /// Helper to get a UsingTaskParameterElement from xml
 /// </summary>
 private static ProjectUsingTaskParameterElement GetParameterXml(string contents)
 {
     ProjectRootElement project = ProjectRootElement.Create(XmlReader.Create(new StringReader(contents)));
     ProjectUsingTaskElement usingTask = (ProjectUsingTaskElement)Helpers.GetFirst(project.Children);
     UsingTaskParameterGroupElement parameterGroup = usingTask.ParameterGroup;
     ProjectUsingTaskParameterElement body = Helpers.GetFirst(parameterGroup.Parameters);
     return body;
 }
Example #4
0
 public void ReadDuplicateChildParameters()
 {
     Assert.Throws <InvalidProjectFileException>(() =>
     {
         UsingTaskParameterGroupElement parameterGroup = GetParameterGroupXml(s_contentDuplicateParameters);
         Assert.True(false);
     }
                                                 );
 }
Example #5
0
        public static void Verify(UsingTaskParameterGroupElement viewXml, UsingTaskParameterGroupElement realXml, ValidationContext context = null)
        {
            if (viewXml == null && realXml == null)
            {
                return;
            }

            VerifyProjectElement(viewXml, realXml, context);

            Verify(viewXml.Parameters, realXml.Parameters, Verify, context);
        }
Example #6
0
        public void ReadDuplicateChildParameters()
        {
            UsingTaskParameterGroupElement parameterGroup = GetParameterGroupXml(s_contentDuplicateParameters);

            Assert.Fail();
        }