Пример #1
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);
        }
Пример #2
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());
        }
Пример #3
0
        public void Path_GetPathRoot()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath    = @"C:\mypath\mypath2\myfile.myex";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction  = "GetPathRoot";

            // act
            target.Execute();

            // assert
            Assert.IsTrue(target.Value == @"C:\");
        }
Пример #4
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");
        }
Пример #5
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");
        }
Пример #6
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");
        }
Пример #7
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");
        }
Пример #8
0
        public void Path_ChangeExtension()
        {
            // arrange
            MSBuild.ExtensionPack.Framework.Path target = new MSBuild.ExtensionPack.Framework.Path();
            target.Filepath    = @"C:\myfile.myex";
            target.Extension   = "log";
            target.BuildEngine = new MockBuildEngine();
            target.TaskAction  = "ChangeExtension";

            // act
            target.Execute();

            // assert
            Assert.IsTrue(target.Value == @"C:\myfile.log");
        }
Пример #9
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");
        }
Пример #10
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");
            }
        }
Пример #11
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");
        }
Пример #12
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");
            }
        }
Пример #13
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());
        }
Пример #14
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);
        }
Пример #15
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");
        }
Пример #16
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");
        }