public async Task TestFilesCopy() { var fullPath = Path.Combine(DirectoryName, FileName); var operationsFactoryMock = new Mock <IOperationsFactory>(); var operationMock = new Mock <IOperation>(); operationMock .Setup(m => m.RunAsync()) .Verifiable(); operationsFactoryMock .Setup(m => m.CreateCopyOperation(It.IsAny <BinaryFileSystemOperationSettings>())) .Callback <BinaryFileSystemOperationSettings>(s => { var(key, value) = s.FilesDictionary.Single(); Assert.Equal(FileName, key); Assert.Equal(fullPath, value); }) .Returns(operationMock.Object); var directoryServiceMock = new Mock <IDirectoryService>(); directoryServiceMock .SetupGet(m => m.SelectedDirectory) .Returns(CurrentDirectory); var fileOpeningServiceMock = new Mock <IResourceOpeningService>(); var fileServiceMock = new Mock <IFileService>(); fileServiceMock .Setup(m => m.CheckIfExists(FileName)) .Returns(true); var fileOperationsStateServiceMock = new Mock <IOperationsStateService>(); var pathServiceMock = new Mock <IPathService>(); pathServiceMock .Setup(m => m.GetCommonRootDirectory(It.IsAny <IReadOnlyList <string> >())) .Returns(string.Empty); pathServiceMock .Setup(m => m.Combine(DirectoryName, FileName)) .Returns(fullPath); pathServiceMock .Setup(m => m.GetRelativePath(string.Empty, FileName)) .Returns(FileName); IOperationsService operationsService = new OperationsService( operationsFactoryMock.Object, directoryServiceMock.Object, fileOpeningServiceMock.Object, fileServiceMock.Object, pathServiceMock.Object, fileOperationsStateServiceMock.Object); await operationsService.CopyAsync(new[] { FileName }, DirectoryName); operationMock.Verify(m => m.RunAsync(), Times.Once()); }