public void File_AbsolutePath_WithoutSession_ReturnsHintPath() { Assert.IsNull(ExecutionEvents.ActiveSession); var relativepath = @"excel\ascending.xlsx"; var hintpath = Path.Combine(TestDirectory, @"do not exist\no file.txt"); Assert.AreEqual(hintpath, FileSystem.AbsolutePath(relativepath, hintpath)); }
public void File_AbsolutePath_WithFullPathInput_ReturnsInput() { Assert.IsNull(ExecutionEvents.ActiveSession); string wspath = Path.Combine(TestDirectory, @"core\files\dummy.dyn"); var relativepath = @"excel\ascending.xlsx"; var hintpath = Path.Combine(TestDirectory, "core", relativepath); Assert.AreEqual(wspath, FileSystem.AbsolutePath(wspath, hintpath)); }
public void File_AbsolutePath_RelativePathDontExist() { Assert.IsNull(ExecutionEvents.ActiveSession); string wspath = Path.Combine(TestDirectory, @"core\files\dummy.dyn"); var session = new Mock <IExecutionSession>(); session.Setup(s => s.CurrentWorkspacePath).Returns(wspath); SetActiveSession(session.Object); var relativepath = @"do not exist\no file.txt"; var expectedpath = Path.Combine(TestDirectory, @"core\files", relativepath); Assert.AreEqual(expectedpath, FileSystem.AbsolutePath(relativepath)); SetActiveSession(null); }
public void File_AbsolutePath_WithValidHintPath_ReturnsHintPath() { Assert.IsNull(ExecutionEvents.ActiveSession); string wspath = Path.Combine(TestDirectory, @"core\files\dummy.dyn"); var session = new Mock <IExecutionSession>(); session.Setup(s => s.CurrentWorkspacePath).Returns(wspath); SetActiveSession(session.Object); var relativepath = @"excel\ascending.xlsx"; var hintpath = Path.Combine(TestDirectory, "core", relativepath); Assert.AreEqual(hintpath, FileSystem.AbsolutePath(relativepath, hintpath)); SetActiveSession(null); }
/// <summary> /// Write the image to a path, given the specified file name. /// </summary> /// <param name="path"></param> /// <param name="image">The image to write</param> /// <returns name="void">No output </returns> /// <search>write image,image,file,filepath</search> public static void WriteToFile(string path, Bitmap image) { image.Save(FileSystem.AbsolutePath(path)); }
/// <summary> /// Write the image to a path, given the specified file name. /// </summary> /// <param name="path"></param> /// <param name="image">The image to write</param> /// <returns name="image">Created image object</returns> /// <search>write image,image,file,filepath</search> public static Bitmap WriteToFile(string path, Bitmap image) { image.Save(FileSystem.AbsolutePath(path)); return(image); }