public async Task Upload_Produces_Diagnostic_When_Removing_Record(string username) { var diag = new Mock <IDiagnosticFactory>(); using (var s = new SoulseekClient(diagnosticFactory: diag.Object)) { var dict = s.GetProperty <ConcurrentDictionary <string, SemaphoreSlim> >("UploadSemaphores"); var sem = new SemaphoreSlim(1, 1); dict.TryAdd(username, sem); await s.InvokeMethod <Task>("CleanupUploadSemaphoresAsync"); } diag.Verify(m => m.Debug(It.Is <string>(s => s.ContainsInsensitive($"cleaned up upload semaphore for {username}"))), Times.Once); }