public CommandDiscovery(ICommandFactory factory, IFileFactoryForPath fileFactory, IFolderFactoryForPath folderFactory) { _factory = factory; _fileFactory = fileFactory; _folderFactory = folderFactory; }
private IFileFactoryForPath GetFileFactoryThatReturnsExistsFor(String fileToReturnTrueFor) { IFileFactoryForPath fileFactory = (f) => { var fileToReturn = new FakeFile(f); fileToReturn.ExistsReturnValue = f.Equals(fileToReturnTrueFor); return(fileToReturn); }; return(fileFactory); }
public void GetCommandListTask_TargetDoesNotExistSourceIsFolder_FolderLinkCreated() { String nonExistentPath = "testFile"; String folderTarget = @"c:\testFolder"; IFileFactoryForPath fileFactory = (s) => new FakeFile(s); var folderFactory = GetFolderFactoryThatReturnsExistsFor(folderTarget); var factory = MockRepository.GenerateMock <ICommandFactory>(); var commandDiscovery = new CommandDiscovery(factory, fileFactory, folderFactory); commandDiscovery.GetCommandListTask(nonExistentPath, folderTarget, false, false); factory.AssertWasCalled(f => f.CreateFolderLinkCommand(Arg <IFolder> .Matches(folder => folder.FolderPath.Equals(nonExistentPath)), Arg <IFolder> .Matches(folder => folder.FolderPath.Equals(folderTarget)))); }
public void GetCommandListTask_TargetDoesNotExistSourceIsFile_FileLinkCreated() { String nonExistentPath = "testFile"; String targetPath = "target"; IFileFactoryForPath fileFactory = GetFileFactoryThatReturnsExistsFor(targetPath); IFolderFactoryForPath folderFactory = (s) => new FakeFolder(s); var factory = MockRepository.GenerateMock <ICommandFactory>(); var commandDiscovery = new CommandDiscovery(factory, fileFactory, folderFactory); commandDiscovery.GetCommandListTask(nonExistentPath, targetPath, false, false); factory.AssertWasCalled(f => f.CreateFileLinkCommand(Arg <IFile> .Matches(file => file.FullFilePath.Equals(nonExistentPath)), Arg <IFile> .Matches(file => file.FullFilePath.Equals(targetPath)))); }
public FolderImp(IFileFactoryForPath fileFactory, IFolderFactoryForPath folderFactory, String path) { FolderPath = path; FileFactoryForFile = fileFactory; FolderFactoryForPath = folderFactory; }
public OperationValidation(IFileFactoryForPath fileFactory, IFolderFactoryForPath folderFactory) { _folderFactory = folderFactory; _fileFactory = fileFactory; }