public async Task ProcessFileAsync_AlreadyProcessing_ReturnsWithoutProcessing() { string testFile = WriteTestFile("dat"); // first take a lock on the status file using (StreamWriter statusFile = processor.AquireStatusFileLock(testFile, WatcherChangeTypes.Created)) { // now attempt to process the file FileSystemEventArgs eventArgs = new FileSystemEventArgs(WatcherChangeTypes.Created, Path.GetDirectoryName(testFile), Path.GetFileName(testFile)); bool fileProcessedSuccessfully = await processor.ProcessFileAsync(eventArgs, CancellationToken.None); Assert.False(fileProcessedSuccessfully); mockExecutor.Verify(p => p.TryExecuteAsync(It.IsAny <TriggeredFunctionData>(), It.IsAny <CancellationToken>()), Times.Never); } string statusFilePath = processor.GetStatusFile(testFile); File.Delete(statusFilePath); }