Пример #1
0
        public void Path_HasExtensionFalse()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath    = @"C:\mypath\mypath2\myfile";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction  = "HasExtension";

            // act
            target.Execute();

            // assert
            Assert.AreEqual(target.Value, "False");
        }
Пример #2
0
        public void Path_IsPathRootedFalse()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath    = @"..\myfile.txt";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction  = "IsPathRooted";

            // act
            target.Execute();

            // assert
            Assert.AreEqual(target.Value, "False");
        }
Пример #3
0
        public void Path_GetDirectoryName()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath    = @"C:\mydir\myfile.txt";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction  = "GetDirectoryName";

            // act
            target.Execute();

            // assert
            Assert.IsTrue(target.Value == @"C:\mydir");
        }
Пример #4
0
        public void Path_GetExtension()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath    = @"C:\myfile.myex";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction  = "GetExtension";

            // act
            target.Execute();

            // assert
            Assert.IsTrue(target.Value == ".myex");
        }
Пример #5
0
        public void Path_GetFullPath()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath = @"C:\myfile.myex";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction = "GetFullPath";

            // act
            target.Execute();

            // assert
            Assert.IsTrue(target.Value == @"C:\myfile.myex");
        }
Пример #6
0
        public void Path_Combine()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath    = @"C:\myfile";
            target.Filepath2   = @"log.txt";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction  = "Combine";

            // act
            target.Execute();

            // assert
            Assert.IsTrue(target.Value == @"C:\myfile\log.txt");
        }
Пример #7
0
        public void Path_GetRandomFileName()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction  = "GetRandomFileName";
            using (ShimsContext.Create())
            {
                System.IO.Fakes.ShimPath.GetRandomFileName = () => "abc.sds";

                // act
                target.Execute();

                // assert
                Assert.AreEqual(target.Value, "abc.sds");
            }
        }
Пример #8
0
        public void Path_Combine()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath = @"C:\myfile";
            target.Filepath2 = @"log.txt";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction = "Combine";

            // act
            target.Execute();

            // assert
            Assert.IsTrue(target.Value == @"C:\myfile\log.txt");
        }
Пример #9
0
        public void Path_GetRandomFileName()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction = "GetRandomFileName";
            using (ShimsContext.Create())
            {
                System.IO.Fakes.ShimPath.GetRandomFileName = () => "abc.sds";

                // act
                target.Execute();

                // assert
                Assert.AreEqual(target.Value, "abc.sds");
            }
        }
Пример #10
0
        public void Path_GetTempPath()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction = "GetTempPath";

            // act
            target.Execute();

            // assert
            Assert.IsTrue(target.Value == System.IO.Path.GetTempPath());
        }
Пример #11
0
        public void Path_InvalidTaskAction()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction = "NotValid";

            // act
            bool result = target.Execute();

            // assert
            Assert.AreEqual(result, false);
        }
Пример #12
0
        public void Path_IsPathRootedTrue()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath = @"c:\myfile.txt";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction = "IsPathRooted";

            // act
            target.Execute();

            // assert
            Assert.AreEqual(target.Value, "True");
        }
Пример #13
0
        public void Path_HasExtensionFalse()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath = @"C:\mypath\mypath2\myfile";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction = "HasExtension";

            // act
            target.Execute();

            // assert
            Assert.AreEqual(target.Value, "False");
        }