/// <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 ReadParameterWithNOAttributes() { ProjectUsingTaskParameterElement parameter = GetParameterXml(s_contentNoAttributesSet); Assert.Equal("MyParameter", parameter.Name); Assert.Equal(typeof(String).FullName, parameter.ParameterType); Assert.Equal(bool.FalseString, parameter.Output); Assert.Equal(bool.FalseString, parameter.Required); }
public void ReadParameterWithAllAttributes() { ProjectUsingTaskParameterElement parameter = GetParameterXml(s_contentAllAttributesSet); Assert.Equal("MyParameter", parameter.Name); Assert.Equal("System.String", parameter.ParameterType); Assert.Equal("true", parameter.Output); Assert.Equal("false", parameter.Required); }
public void SetNullRequired() { ProjectUsingTaskParameterElement parameter = GetParameterXml(s_contentAllAttributesSet); Helpers.ClearDirtyFlag(parameter.ContainingProject); parameter.Required = null; Assert.Equal(bool.FalseString, parameter.Required); Assert.True(parameter.ContainingProject.HasUnsavedChanges); }
public void SetNullType() { ProjectUsingTaskParameterElement parameter = GetParameterXml(s_contentAllAttributesSet); Helpers.ClearDirtyFlag(parameter.ContainingProject); parameter.ParameterType = null; Assert.Equal(typeof(String).FullName, parameter.ParameterType); Assert.True(parameter.ContainingProject.HasUnsavedChanges); }
public void SetEmptyOutput() { ProjectUsingTaskParameterElement parameter = GetParameterXml(s_contentAllAttributesSet); Helpers.ClearDirtyFlag(parameter.ContainingProject); parameter.Output = String.Empty; Assert.Equal(bool.FalseString, parameter.Output); Assert.True(parameter.ContainingProject.HasUnsavedChanges); }
public void SetType() { ProjectUsingTaskParameterElement parameter = GetParameterXml(s_contentAllAttributesSet); Helpers.ClearDirtyFlag(parameter.ContainingProject); parameter.ParameterType = "newType"; Assert.Equal("newType", parameter.ParameterType); Assert.True(parameter.ContainingProject.HasUnsavedChanges); }
public void SetRequired() { ProjectUsingTaskParameterElement parameter = GetParameterXml(s_contentAllAttributesSet); Helpers.ClearDirtyFlag(parameter.ContainingProject); parameter.Required = "required"; Assert.Equal("required", parameter.Required); Assert.Equal(true, parameter.ContainingProject.HasUnsavedChanges); }
public void SetOutput() { ProjectUsingTaskParameterElement parameter = GetParameterXml(s_contentAllAttributesSet); Helpers.ClearDirtyFlag(parameter.ContainingProject); parameter.Output = "output"; Assert.Equal("output", parameter.Output); Assert.Equal(true, parameter.ContainingProject.HasUnsavedChanges); }
public void SetNullOutput() { ProjectUsingTaskParameterElement parameter = GetParameterXml(contentAllAttributesSet); Helpers.ClearDirtyFlag(parameter.ContainingProject); parameter.Output = null; Assert.AreEqual(bool.FalseString, parameter.Output); Assert.AreEqual(true, parameter.ContainingProject.HasUnsavedChanges); }
public void SetEmptyRequired() { ProjectUsingTaskParameterElement parameter = GetParameterXml(contentAllAttributesSet); Helpers.ClearDirtyFlag(parameter.ContainingProject); parameter.Required = String.Empty; Assert.AreEqual(bool.FalseString, parameter.Required); Assert.AreEqual(true, parameter.ContainingProject.HasUnsavedChanges); }
public static void Verify(ProjectUsingTaskParameterElement viewXml, ProjectUsingTaskParameterElement realXml, ValidationContext context = null) { if (viewXml == null && realXml == null) { return; } VerifyProjectElement(viewXml, realXml, context); Assert.Equal(realXml.Name, viewXml.Name); Assert.Equal(realXml.ParameterType, viewXml.ParameterType); VerifySameLocation(realXml.ParameterTypeLocation, viewXml.ParameterTypeLocation, context); Assert.Equal(realXml.Output, viewXml.Output); VerifySameLocation(realXml.OutputLocation, viewXml.OutputLocation, context); Assert.Equal(realXml.Required, viewXml.Required); VerifySameLocation(realXml.RequiredLocation, viewXml.RequiredLocation, context); }