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); }
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()); }
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:\"); }
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"); }
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"); }
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"); }
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"); }
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"); }
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"); }
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"); } }
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"); }
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"); } }
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()); }
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); }
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"); }
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"); }