public void Count_IncrementOnAddFile()
 {
     Project p = new Project(new Engine());
     Assertion.AssertEquals(0, p.UsingTasks.Count);
     p.AddNewUsingTaskFromAssemblyFile("TaskName", "AssemblyFile.dll");
     Assertion.AssertEquals(0, p.UsingTasks.Count);
     object o = p.EvaluatedProperties;
     Assertion.AssertEquals(1, p.UsingTasks.Count);
 }
Example #2
0
 /// <summary>
 /// Set an assembly file name, then retrieve it. 
 /// </summary>
 private string SetandGetAssemblyFileName(string assemblyFileName)
 {
     Project p = new Project();
     p.AddNewUsingTaskFromAssemblyFile("TaskName", assemblyFileName);
     object o = p.EvaluatedItems;
     UsingTask usingTask = CompatibilityTestHelpers.FindUsingTaskByName("TaskName", p.UsingTasks);
     return usingTask.AssemblyFile;
 }   
Example #3
0
 public void GetAssemblyFileNameScalarEvaluation()
 {
         string assemblyFileName = "$(fileName)";
         Project p = new Project(new Engine());
         p.SetProperty("fileName", "aFileName");
         object o = p.EvaluatedItems;
         p.AddNewUsingTaskFromAssemblyFile("TaskName", assemblyFileName);
         o = p.EvaluatedItems;
         Assertion.AssertEquals(assemblyFileName, CompatibilityTestHelpers.FindUsingTaskByName("TaskName", p.UsingTasks).AssemblyFile);
 }
 public void CopyTo_OffsetIndexArrayTooSmall()
 {
     int offSet = 3;
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("TaskName1", "AssemblyFile1.dll");
     p.AddNewUsingTaskFromAssemblyFile("TaskName2", "AssemblyFile2.dll");
     UsingTask[] usingTasks = new UsingTask[p.UsingTasks.Count];
     p.UsingTasks.CopyTo(usingTasks, offSet);
 }
 public void CopyTo_WeakAndGetEnumerator()
 {
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("TaskName1", "AssemblyFile1.dll");
     p.AddNewUsingTaskFromAssemblyFile("TaskName2", "AssemblyFile2.dll");
     Array taskArray = Array.CreateInstance(typeof(UsingTask), p.UsingTasks.Count);
     p.UsingTasks.CopyTo(taskArray, 0);
     Assertion.AssertEquals(p.UsingTasks.Count, taskArray.Length);
     int i = 0;
     foreach (UsingTask usingTask in p.UsingTasks)
     {
         Assertion.AssertEquals(((UsingTask)taskArray.GetValue(i)), usingTask.AssemblyFile);
         i++;
     }
 }
 public void CopyTo_ZeroIndex()
 {
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("TaskName1", "AssemblyFile1.dll");
     p.AddNewUsingTaskFromAssemblyFile("TaskName2", "AssemblyFile2.dll");
     UsingTask[] usingTasks = new UsingTask[p.UsingTasks.Count];
     p.UsingTasks.CopyTo(usingTasks, 0);
     int i = 0;
     foreach (UsingTask usingTask in p.UsingTasks)
     {
         Assertion.AssertEquals(usingTasks[i].AssemblyFile, usingTask.AssemblyFile);
         i++;
     }
 }
 public void CopyTo_OffsetIndex()
 {
     int offSet = 3;
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("TaskName1", "AssemblyFile1.dll");
     p.AddNewUsingTaskFromAssemblyFile("TaskName2", "AssemblyFile2.dll");
     UsingTask[] taskArray = new UsingTask[p.UsingTasks.Count + offSet];
     p.UsingTasks.CopyTo(taskArray, offSet);
     int i = offSet - 1;
     Assertion.AssertNull(taskArray[offSet - 1]);
     foreach (UsingTask usingTask in p.UsingTasks)
     {
         Assertion.AssertEquals(taskArray[i].AssemblyFile, usingTask.AssemblyFile);
         i++;
     }
 }
 public void IsSynchronized() 
 {
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("TaskName", "AssemblyFile.dll");
     Assertion.AssertEquals(false, p.UsingTasks.IsSynchronized);
 }
 public void Count_DecrementOnRemove()
 {
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("TaskName", "AssemblyFile.dll");
     object o = p.EvaluatedProperties;
     Assertion.AssertEquals(1, p.UsingTasks.Count);
     p.LoadXml(TestData.ContentSimpleTools35);
     Assertion.AssertEquals(0, p.UsingTasks.Count);
     o = p.EvaluatedProperties;
     Assertion.AssertEquals(0, p.UsingTasks.Count);
 }
Example #10
0
 public void AddNewUsingTaskFromInvalidAssemblyEvaluated()
 {
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("taskName", @"invalid|.dll");
     object o = p.EvaluatedItems; // force evaluation of imported projects.
 }
Example #11
0
 public void AddNewUsingTaskFromInvalidAssemblyNotEvaluated()
 {
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("taskName", @"invalid|.dll");
     Assertion.Assert("no exception", true);
 }
Example #12
0
 public void AddNewUsingTaskFromAssemblyFileUsingTasksCollectionGet()
 {
     Project p = new Project(new Engine());
     p.AddNewUsingTaskFromAssemblyFile("UsingTaskName", @"c:\assembly.dll");
     object o = p.EvaluatedItems; // force evaluation of imported projects.
     Assertion.AssertEquals(true, p.IsDirty);
     XmlNodeList nl = CompatibilityTestHelpers.GetNodesWithName(p.Xml, "UsingTask");
     Assertion.AssertEquals(1, nl.Count);
     Assertion.AssertEquals("UsingTaskName", nl[0].Attributes["TaskName"].Value);
     Assertion.AssertEquals(@"c:\assembly.dll", nl[0].Attributes["AssemblyFile"].Value);
     Assertion.AssertEquals(2, nl[0].Attributes.Count); // no condition;
 }