TestObservable.cs 591 B

1234567891011121314151617181920
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System;
  4. using System.Reactive.Disposables;
  5. namespace Avalonia.Styling.UnitTests
  6. {
  7. public class TestObservable : IObservable<bool>
  8. {
  9. public int SubscribedCount { get; private set; }
  10. public IDisposable Subscribe(IObserver<bool> observer)
  11. {
  12. ++SubscribedCount;
  13. observer.OnNext(true);
  14. return Disposable.Create(() => --SubscribedCount);
  15. }
  16. }
  17. }