public void TestAssignment () { CombinePath cp = new CombinePath (); cp.BasePath = "a"; cp.Paths = new ITaskItem [] { new TaskItem ("b")}; Assert.AreEqual ("a", cp.BasePath, "A1"); Assert.AreEqual ("b", cp.Paths [0].ItemSpec, "A2"); }
public void AbsoluteRelative1() { CombinePath t = new CombinePath(); t.BuildEngine = new MockEngine(); t.BasePath = @"c:\abc\def"; t.Paths = new ITaskItem[] { new TaskItem(@"\ghi\jkl.txt"), new TaskItem(@"mno\qrs.txt") }; Assert.IsTrue(t.Execute(), "success"); ObjectModelHelpers.AssertItemsMatch( @"\ghi\jkl.txt" + "\r\n" + // I think this is a bug in Path.Combine. It should have been "c:\ghi\jkl.txt". @"c:\abc\def\mno\qrs.txt", t.CombinedPaths, true); }
public void RelativeRelative1() { CombinePath t = new CombinePath(); t.BuildEngine = new MockEngine(); t.BasePath = @"abc\def"; t.Paths = new ITaskItem[] { new TaskItem(@"ghi.txt"), new TaskItem(@"jkl\mno.txt") }; Assert.IsTrue(t.Execute(), "success"); ObjectModelHelpers.AssertItemsMatch(@" abc\def\ghi.txt abc\def\jkl\mno.txt ", t.CombinedPaths, true); }
public void AbsoluteAbsolute1() { CombinePath t = new CombinePath(); t.BuildEngine = new MockEngine(); t.BasePath = @"\\fileserver\public"; t.Paths = new ITaskItem[] { new TaskItem(@"c:\ghi.txt"), new TaskItem(@"d:\jkl\mno.txt"), new TaskItem(@"\\myserver\myshare") }; Assert.IsTrue(t.Execute(), "success"); ObjectModelHelpers.AssertItemsMatch(@" c:\ghi.txt d:\jkl\mno.txt \\myserver\myshare ", t.CombinedPaths, true); }
public void MetadataPreserved() { CombinePath t = new CombinePath(); t.BuildEngine = new MockEngine(); t.BasePath = @"c:\abc\def\"; t.Paths = new ITaskItem[] { new TaskItem(@"jkl\mno.txt") }; t.Paths[0].SetMetadata("Culture", "english"); Assert.IsTrue(t.Execute(), "success"); ObjectModelHelpers.AssertItemsMatch(@" c:\abc\def\jkl\mno.txt : Culture=english ", t.CombinedPaths, true); }
public void InvalidPath() { CombinePath t = new CombinePath(); t.BuildEngine = new MockEngine(true); t.BasePath = @"c:\abc\def"; t.Paths = new ITaskItem[] { new TaskItem("ghi.txt"), new TaskItem("|.txt"), new TaskItem("jkl.txt") }; Assert.IsFalse(t.Execute(), "should have failed"); ((MockEngine)t.BuildEngine).AssertLogContains("MSB3095"); ObjectModelHelpers.AssertItemsMatch(@" c:\abc\def\ghi.txt c:\abc\def\jkl.txt ", t.CombinedPaths, true); }
public void BlankPath() { CombinePath t = new CombinePath(); t.BuildEngine = new MockEngine(); t.BasePath = @"c:\abc\def"; t.Paths = new ITaskItem[] { new TaskItem("") }; Assert.IsTrue(t.Execute(), "success"); ObjectModelHelpers.AssertItemsMatch(@" c:\abc\def ", t.CombinedPaths, true); }
public void NoPaths() { CombinePath t = new CombinePath(); t.BuildEngine = new MockEngine(); t.BasePath = @"c:\abc\def"; t.Paths = new ITaskItem[0]; Assert.True(t.Execute()); // "success" ObjectModelHelpers.AssertItemsMatch(@" ", t.CombinedPaths, true); }
public void NoBasePath() { CombinePath t = new CombinePath(); t.BuildEngine = new MockEngine(); t.Paths = new ITaskItem[] { new TaskItem(@"jkl\mno.txt"), new TaskItem(@"c:\abc\def\ghi.txt") }; Assert.True(t.Execute()); // "success" ObjectModelHelpers.AssertItemsMatch(@" jkl\mno.txt c:\abc\def\ghi.txt ", t.CombinedPaths, true); }