public void EnsureUniqueDirectory_GivenNonExistingDirectory_ReturnsSameDirectory() { const string path = @"C:\TestFolder\MySubFolder"; var directoryWrap = MockRepository.GenerateStub <IDirectory>(); directoryWrap.Stub(x => x.Exists(path)).Return(false); var fileWrap = MockRepository.GenerateStub <IFile>(); directoryWrap.Stub(x => x.Exists(path)).Return(false); var uniqueDirectory = new UniqueDirectory(path, directoryWrap, fileWrap); Assert.AreEqual(path, uniqueDirectory.MakeUniqueDirectory()); }
public void EnsureUniqueDirectory_GivenExisting_ReturnsUniquifiedDirectory() { const string path = @"C:\TestFolder\FileNameAsSubFolder.xx"; const string expectedPath = @"C:\TestFolder\FileNameAsSubFolder.xx_2"; var directoryWrap = MockRepository.GenerateStub <IDirectory>(); directoryWrap.Stub(x => x.Exists(path)).Return(false); var fileWrap = MockRepository.GenerateStub <IFile>(); fileWrap.Stub(x => x.Exists(path)).Return(true); var uniqueDirectory = new UniqueDirectory(path, directoryWrap, fileWrap); Assert.AreEqual(expectedPath, uniqueDirectory.MakeUniqueDirectory()); }