public void ReadBody() { ProjectUsingTaskBodyElement body = GetBodyXml(); Assert.Equal(body.Evaluate, bool.FalseString, true); Assert.Equal("Contents", body.TaskBody); }
public void ReadBody() { ProjectUsingTaskBodyElement body = GetBodyXml(); Assert.IsTrue(bool.FalseString.Equals(body.Evaluate, StringComparison.OrdinalIgnoreCase)); Assert.AreEqual("Contents", body.TaskBody); }
public void SetInvalidNullValue() { ProjectUsingTaskBodyElement body = GetBodyXml(); body.TaskBody = null; Assert.Fail(); }
public void SetEvaluateAttributeToNull() { ProjectUsingTaskBodyElement body = GetBodyXml(); Assert.Contains("Evaluate", body.ContainingProject.RawXml); body.Evaluate = null; Assert.DoesNotContain("Evaluate", body.ContainingProject.RawXml); Assert.Equal(bool.TrueString, body.Evaluate); }
public void SetEvaluateAttributeToNull() { ProjectUsingTaskBodyElement body = GetBodyXml(); Assert.IsTrue(body.ContainingProject.RawXml.Contains("Evaluate")); body.Evaluate = null; Assert.IsTrue(!body.ContainingProject.RawXml.Contains("Evaluate")); Assert.AreEqual(bool.TrueString, body.Evaluate); }
public void SetEmptyValue() { ProjectUsingTaskBodyElement body = GetBodyXml(); Helpers.ClearDirtyFlag(body.ContainingProject); body.TaskBody = String.Empty; Assert.Equal(String.Empty, body.TaskBody); Assert.True(body.ContainingProject.HasUnsavedChanges); }
public void SetValue() { ProjectUsingTaskBodyElement body = GetBodyXml(); Helpers.ClearDirtyFlag(body.ContainingProject); body.TaskBody = "MoreContents"; Assert.Equal("MoreContents", body.TaskBody); Assert.True(body.ContainingProject.HasUnsavedChanges); }
public void SetInvalidNullValue() { Assert.Throws <ArgumentNullException>(() => { ProjectUsingTaskBodyElement body = GetBodyXml(); body.TaskBody = null; Assert.True(false); } ); }
public static void Verify(ProjectUsingTaskBodyElement viewXml, ProjectUsingTaskBodyElement realXml, ValidationContext context = null) { if (viewXml == null && realXml == null) { return; } VerifyProjectElement(viewXml, realXml, context); Assert.Equal(realXml.TaskBody, viewXml.TaskBody); Assert.Equal(realXml.Evaluate, viewXml.Evaluate); VerifySameLocation(realXml.EvaluateLocation, viewXml.EvaluateLocation, context); }
/// <summary> /// Helper to get a ProjectUsingTaskBodyElement for a simple task /// </summary> private static ProjectUsingTaskBodyElement GetBodyXml() { string content = @" <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' > <UsingTask TaskName='SuperTask' AssemblyFile='af' TaskFactory='AssemblyFactory'> <Task Evaluate='false'>Contents</Task> </UsingTask> </Project> "; ProjectRootElement project = ProjectRootElement.Create(XmlReader.Create(new StringReader(content))); ProjectUsingTaskElement usingTask = (ProjectUsingTaskElement)Helpers.GetFirst(project.Children); ProjectUsingTaskBodyElement body = usingTask.TaskBody; return(body); }