Exemple #1
0
        public void ExistsWhenImportedTargetAndParentTargetHaveSameName()
        {
            string importProjectContents = @" 
                    <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                        <Target Name='t1'>
                            <Message Text='imported.t2.task' />
                        </Target>
                    </Project>
                ";

            string parentProjectContents = @" 
                    <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                        <Target Name='t1'>
                            <Message Text='parent.t1.task' />
                        </Target>
                        <Target Name='t2' />
                        <Import Project='import.proj' />
                    </Project>
                ";

            Project          p       = GetProjectThatImportsAnotherProject(importProjectContents, parentProjectContents);
            TargetCollection targets = p.Targets;

            Assertion.AssertEquals(true, targets.Exists("t1"));
        }
Exemple #2
0
        public void ExistsOfImportedTarget()
        {
            Project          p       = GetProjectThatImportsAnotherProject(null, null);
            TargetCollection targets = p.Targets;

            Assertion.AssertEquals(true, targets.Exists("t4"));
        }
Exemple #3
0
        public void ExistsWhenTargetDoesNotExist()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            Assertion.AssertEquals(false, targets.Exists("tNot"));
        }
Exemple #4
0
        public void ExistsWhenTargetExists()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            Assertion.AssertEquals(true, targets.Exists("t2"));
        }
Exemple #5
0
        public void RemoveTargetOfExistingTarget()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            targets.RemoveTarget(GetSpecificTargetFromProject(project, "t1"));

            Assertion.AssertEquals(false, targets.Exists("t1"));
        }
Exemple #6
0
        public void AddNewTargetWhenNoOtherTargetsExist()
        {
            project.LoadXml(ProjectContentNoTargets);
            TargetCollection targets = project.Targets;

            targets.AddNewTarget("t");

            Assertion.AssertEquals(true, targets.Exists("t"));
            Assertion.AssertEquals(1, targets.Count);
        }
Exemple #7
0
        public void AddNewTargetWhenTargetOfSameNameAlreadyExists()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            targets.AddNewTarget("t1");

            Assertion.AssertEquals(true, targets.Exists("t1"));
            Assertion.AssertEquals(5, targets.Count);
        }
Exemple #8
0
        public void AddNewTargetSimple()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            targets.AddNewTarget("tNew");

            Assertion.AssertEquals(true, targets.Exists("tNew"));
            Assertion.AssertEquals(6, targets.Count);
        }