示例#1
0
        public void ReadBody()
        {
            ProjectUsingTaskBodyElement body = GetBodyXml();

            Assert.Equal(body.Evaluate, bool.FalseString, true);
            Assert.Equal("Contents", body.TaskBody);
        }
示例#2
0
        public void ReadBody()
        {
            ProjectUsingTaskBodyElement body = GetBodyXml();

            Assert.IsTrue(bool.FalseString.Equals(body.Evaluate, StringComparison.OrdinalIgnoreCase));
            Assert.AreEqual("Contents", body.TaskBody);
        }
示例#3
0
        public void SetInvalidNullValue()
        {
            ProjectUsingTaskBodyElement body = GetBodyXml();

            body.TaskBody = null;
            Assert.Fail();
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        public void SetValue()
        {
            ProjectUsingTaskBodyElement body = GetBodyXml();

            Helpers.ClearDirtyFlag(body.ContainingProject);

            body.TaskBody = "MoreContents";
            Assert.Equal("MoreContents", body.TaskBody);
            Assert.True(body.ContainingProject.HasUnsavedChanges);
        }
示例#8
0
 public void SetInvalidNullValue()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         ProjectUsingTaskBodyElement body = GetBodyXml();
         body.TaskBody = null;
         Assert.True(false);
     }
                                           );
 }
示例#9
0
        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);
        }
示例#10
0
        /// <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);
        }