MockDisposable.cs 729 B

1234567891011121314151617181920212223242526
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Collections.Generic;
  6. using Microsoft.Reactive.Testing;
  7. namespace ReactiveTests
  8. {
  9. public class MockDisposable : List<long>, IDisposable
  10. {
  11. private TestScheduler _scheduler;
  12. public MockDisposable(TestScheduler scheduler)
  13. {
  14. this._scheduler = scheduler ?? throw new ArgumentNullException(nameof(scheduler));
  15. Add(scheduler.Clock);
  16. }
  17. public void Dispose()
  18. {
  19. Add(_scheduler.Clock);
  20. }
  21. }
  22. }