public void RelativePathWithEscaping() { string fileName = ObjectModelHelpers.CreateFileInTempProjectDirectory("file%3A.temp", "foo"); FileInfo testFile = new FileInfo(fileName); ConvertToAbsolutePath t = new ConvertToAbsolutePath(); t.BuildEngine = new MockEngine(); string currentDirectory = Directory.GetCurrentDirectory(); try { Directory.SetCurrentDirectory(ObjectModelHelpers.TempProjectDir); t.Paths = new ITaskItem[] { new TaskItem(@"file%253A.temp") }; Assert.IsTrue(t.Execute(), "success"); } finally { Directory.SetCurrentDirectory(currentDirectory); } Assert.AreEqual(1, t.AbsolutePaths.Length); Assert.AreEqual(testFile.FullName, t.AbsolutePaths[0].ItemSpec); ObjectModelHelpers.DeleteTempProjectDirectory(); }
public void FakeFile() { ConvertToAbsolutePath t = new ConvertToAbsolutePath(); t.BuildEngine = new MockEngine(); t.Paths = new ITaskItem[] { new TaskItem("RandomFileThatDoesntExist.txt") }; Assert.IsTrue(t.Execute(), "success"); Assert.AreEqual(1, t.AbsolutePaths.Length); }