TestBase.cs 809 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Threading;
  6. namespace ReactiveTests
  7. {
  8. public class TestBase
  9. {
  10. public void RunAsync(Action<Waiter> a)
  11. {
  12. var w = new Waiter();
  13. a(w);
  14. w.Wait();
  15. }
  16. }
  17. public class Waiter
  18. {
  19. private readonly ManualResetEvent _evt = new(false);
  20. public void Set()
  21. {
  22. _evt.Set();
  23. }
  24. public void Wait()
  25. {
  26. _evt.WaitOne();
  27. }
  28. }
  29. [AttributeUsage(AttributeTargets.Method)]
  30. public class AsynchronousAttribute : Attribute
  31. {
  32. }
  33. }