示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }