Beispiel #1
0
 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));
 }
Beispiel #2
0
 public void ShouldRemoveTheNumberAndTheParenthesis()
 {
     Program program = new Program(Mock.Of<IFileSystem>());
     Assert.AreEqual("test.png", program.DestinationFile("test (1).png"));
 }
Beispiel #3
0
 public void ShouldNotRenameWhenTheFileHasNoSuffix()
 {
     Program program = new Program(Mock.Of<IFileSystem>());
     Assert.IsFalse(program.CanRenameSafely("test.png"));
 }
Beispiel #4
0
 public void ShouldNotRecognizeFilenameWithoutPostfixNumber()
 {
     Program program = new Program(Mock.Of<IFileSystem>());
     Assert.IsFalse(program.FilenameEndsWithNumberInParenthesis("filename.png"));
 }