Пример #1
0
 public void NotFound()
 {
     FindAppConfigFile f = new FindAppConfigFile();
     f.BuildEngine = new MockEngine();
     f.PrimaryList = new ITaskItem[] { new TaskItem("yyy"), new TaskItem("xxx") };
     f.SecondaryList = new ITaskItem[] { new TaskItem("iii"), new TaskItem("xxx") };
     f.TargetPath = "targetpath";
     Assert.True(f.Execute());
     Assert.Equal(null, f.AppConfigFile);
 }
Пример #2
0
 public void MatchFileNameOnlyWithAnInvalidPath()
 {
     FindAppConfigFile f = new FindAppConfigFile();
     f.BuildEngine = new MockEngine();
     f.PrimaryList = new ITaskItem[] { new TaskItem("yyy"), new TaskItem("xxx") };
     f.SecondaryList = new ITaskItem[] { new TaskItem("|||"), new TaskItem(@"foo\\app.config"), new TaskItem(@"!@#$@$%|"), new TaskItem("uuu") };
     f.TargetPath = "targetpath";
     Assert.True(f.Execute());
     // Should ignore the invalid paths
     Assert.Equal(@"foo\\app.config", f.AppConfigFile.ItemSpec);
 }
Пример #3
0
 public void FoundInSecondBelowProjectDirectory()
 {
     FindAppConfigFile f = new FindAppConfigFile();
     f.BuildEngine = new MockEngine();
     f.PrimaryList = new ITaskItem[] { new TaskItem("yyy"), new TaskItem("xxx") };
     f.SecondaryList = new ITaskItem[] { new TaskItem("foo\\app.config"), new TaskItem("xxx") };
     f.TargetPath = "targetpath";
     Assert.True(f.Execute());
     Assert.Equal("foo\\app.config", f.AppConfigFile.ItemSpec);
     Assert.Equal("targetpath", f.AppConfigFile.GetMetadata("TargetPath"));
 }
Пример #4
0
 public void ReturnsLastOne()
 {
     FindAppConfigFile f = new FindAppConfigFile();
     f.BuildEngine = new MockEngine();
     ITaskItem item1 = new TaskItem("app.config");
     item1.SetMetadata("id", "1");
     ITaskItem item2 = new TaskItem("app.config");
     item2.SetMetadata("id", "2");
     f.PrimaryList = new ITaskItem[] { item1, item2 };
     f.SecondaryList = new ITaskItem[] { };
     f.TargetPath = "targetpath";
     Assert.True(f.Execute());
     Assert.Equal("app.config", f.AppConfigFile.ItemSpec);
     Assert.Equal(item2.GetMetadata("id"), f.AppConfigFile.GetMetadata("id"));
 }