public void Cleanup()
 {
     try
     {
         var signatures     = _adminClient.GetSenderSignaturesAsync().WaitForResult();
         var pendingDeletes = new List <Task>();
         foreach (var f in signatures.SenderSignatures)
         {
             if (Regex.IsMatch(f.EmailAddress, _senderprefix))
             {
                 var deleteTask = _adminClient.DeleteSignatureAsync(f.ID);
                 pendingDeletes.Add(deleteTask);
             }
         }
         Task.WaitAll(pendingDeletes.ToArray());
     }
     catch
     {
         //don't fail the test run if deleting all these wasn't possible.
     }
 }
 private Task Cleanup()
 {
     return(Task.Run(async() =>
     {
         try
         {
             var signatures = await _adminClient.GetSenderSignaturesAsync();
             var pendingDeletes = new List <Task>();
             foreach (var f in signatures.SenderSignatures)
             {
                 if (Regex.IsMatch(f.EmailAddress, _senderprefix))
                 {
                     var deleteTask = _adminClient.DeleteSignatureAsync(f.ID);
                     pendingDeletes.Add(deleteTask);
                 }
             }
             Task.WaitAll(pendingDeletes.ToArray());
         }
         catch {}
     }));
 }