public void Execute_NonExistingFile_ExternalDependencyNotFound() { var nonExistingFile = @"Temp\nonExistingFile.txt"; var targetFile = @"Temp\Target\TextCopy.txt"; var copyInfo = Mock.Of<ICopyCommand> ( c => c.SourceFullPath == nonExistingFile && c.FullPath == targetFile ); var command = new CopyCommand(copyInfo); Assert.Throws<ExternalDependencyNotFoundException>(() => command.Execute()); }
public void Execute_ExistingFile_FileIsCopied() { var existingFile = @"Temp\Text.txt"; var targetFile = @"Temp\Target\TextCopy.txt"; File.WriteAllText(existingFile, "a little text"); var copyInfo = Mock.Of<ICopyCommand> ( c =>c.SourceFullPath == existingFile && c.FullPath == targetFile ); var command = new CopyCommand(copyInfo); command.Execute(); Assert.That(File.Exists(existingFile), Is.True); Assert.That(File.Exists(targetFile), Is.True); }