public async Task SynchronizeFile_ShouldCallAddSynchronization( [Frozen]Mock<ISynchronizedFilesRepository> syncFilesRepository, [Frozen]Mock<IFileSynchronizer> synchronizer, SynchronizeFileService sut, SourceFilePath sourceFilePath, TargetFilePath mirroredFilePath ) { //arrange syncFilesRepository.Setup(s => s.GetMirroredFilePath(It.IsAny<CancellationToken>(), sourceFilePath.File)) .ReturnsTask(mirroredFilePath.File); //act await sut.SynchronizeFile(CancellationToken.None, sourceFilePath.File); //assert var c = new FileInfoEqualityComparer(); syncFilesRepository.Verify( s => s.AddSynchronization( It.IsAny<CancellationToken>(), It.Is<FileInfo>(f => c.Equals(f, sourceFilePath.File)) ) ); }
public async Task SynchronizeFile_ShouldCallSynchronizer( [Frozen]Mock<ISynchronizedFilesRepository> syncFilesRepository, [Frozen]Mock<IFileSynchronizer> synchronizer, SynchronizeFileService sut, SourceFilePath sourceFilePath, TargetFilePath mirroredFilePath ) { //arrange syncFilesRepository.Setup(s => s.GetMirroredFilePath(It.IsAny<CancellationToken>(), sourceFilePath.File)) .ReturnsTask(mirroredFilePath.File); //act await sut.SynchronizeFile(CancellationToken.None, sourceFilePath.File); //assert synchronizer.Verify(s => s.Synchronize(It.IsAny<CancellationToken>(), It.Is((IFileInfo f) => sourceFilePath.File == f.File))); }