public void ShouldNotRenameWhenTheFileHasSuffixAndTargetFileExists() { var sourceFile = Path.Combine(Path.GetTempPath(), "test (1).png"); var destFile = Path.Combine(Path.GetTempPath(), "test.png"); Program program = new Program(Mock.Of<IFileSystem>(f => f.FileExists(destFile) == true)); Assert.IsFalse(program.CanRenameSafely(sourceFile)); }
public void ShouldRemoveTheNumberAndTheParenthesis() { Program program = new Program(Mock.Of<IFileSystem>()); Assert.AreEqual("test.png", program.DestinationFile("test (1).png")); }
public void ShouldNotRenameWhenTheFileHasNoSuffix() { Program program = new Program(Mock.Of<IFileSystem>()); Assert.IsFalse(program.CanRenameSafely("test.png")); }
public void ShouldNotRecognizeFilenameWithoutPostfixNumber() { Program program = new Program(Mock.Of<IFileSystem>()); Assert.IsFalse(program.FilenameEndsWithNumberInParenthesis("filename.png")); }