public void TestThatFileName_HasSuffix() { string originalFilePath = @"C:\Picture\apple.jpg"; FilePathSplitter filePath = new FilePathSplitter(originalFilePath); string newFilePath = filePath.GetFileNameWithSuffix("test"); Assert.AreEqual("apple_test.jpg", newFilePath); }
private void SaveButton_Click(object sender, EventArgs e) { filePath = new FilePathSplitter(openFileDialog.FileName); saveFileDialog.Filter = "jpeg (*.jpg)|*.jpg|png (*.png)|*.png) "; saveFileDialog.InitialDirectory = filePath.GetFileDirectory(); saveFileDialog.FileName = filePath.GetFileNameWithSuffix((string)editedImageBox.Image.Tag); if (saveFileDialog.ShowDialog() == DialogResult.OK) { image.SaveImage((Bitmap)editedImageBox.Image, saveFileDialog.FileName); } }