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); }
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; }
public void ReadDuplicateChildParameters() { Assert.Throws <InvalidProjectFileException>(() => { UsingTaskParameterGroupElement parameterGroup = GetParameterGroupXml(s_contentDuplicateParameters); Assert.True(false); } ); }
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); }
public void ReadDuplicateChildParameters() { UsingTaskParameterGroupElement parameterGroup = GetParameterGroupXml(s_contentDuplicateParameters); Assert.Fail(); }