public void Success()
        {
            var ms = new MaybeSubject <int>();

            Assert.False(ms.HasObservers);
            Assert.False(ms.HasCompleted());
            Assert.False(ms.HasException());
            Assert.IsNull(ms.GetException());
            Assert.False(ms.HasValue());
            Assert.False(ms.TryGetValue(out var _));

            var to = ms.Test();

            Assert.True(ms.HasObservers);
            Assert.False(ms.HasCompleted());
            Assert.False(ms.HasException());
            Assert.IsNull(ms.GetException());
            Assert.False(ms.HasValue());
            Assert.False(ms.TryGetValue(out var _));

            to.AssertSubscribed().AssertEmpty();

            ms.OnSuccess(1);

            Assert.False(ms.HasObservers);
            Assert.False(ms.HasCompleted());
            Assert.False(ms.HasException());
            Assert.IsNull(ms.GetException());
            Assert.True(ms.HasValue());
            var v = default(int);

            Assert.True(ms.TryGetValue(out v));
            Assert.AreEqual(1, v);

            to.AssertResult(1);

            ms.Test().AssertSubscribed().AssertResult(1);

            ms.Test(true).AssertSubscribed().AssertEmpty();
        }
        public void Error()
        {
            var ms = new MaybeSubject <int>();

            Assert.False(ms.HasObserver());
            Assert.False(ms.HasCompleted());
            Assert.False(ms.HasException());
            Assert.IsNull(ms.GetException());
            Assert.False(ms.HasValue());
            Assert.False(ms.TryGetValue(out var _));

            var to = ms.Test();

            Assert.True(ms.HasObserver());
            Assert.False(ms.HasCompleted());
            Assert.False(ms.HasException());
            Assert.IsNull(ms.GetException());
            Assert.False(ms.HasValue());
            Assert.False(ms.TryGetValue(out var _));

            to.AssertSubscribed().AssertEmpty();

            ms.OnError(new InvalidOperationException());

            Assert.False(ms.HasObserver());
            Assert.False(ms.HasCompleted());
            Assert.True(ms.HasException());
            Assert.IsNotNull(ms.GetException());
            Assert.True(typeof(InvalidOperationException).IsAssignableFrom(ms.GetException().GetType()));

            Assert.False(ms.HasValue());
            Assert.False(ms.TryGetValue(out var _));

            to.AssertFailure(typeof(InvalidOperationException));

            ms.Test().AssertSubscribed().AssertFailure(typeof(InvalidOperationException));

            ms.Test(true).AssertSubscribed().AssertEmpty();
        }
        public void Complete()
        {
            var ms = new MaybeSubject <int>();

            Assert.False(ms.HasObserver());
            Assert.False(ms.HasCompleted());
            Assert.False(ms.HasException());
            Assert.IsNull(ms.GetException());
            Assert.False(ms.HasValue());
            Assert.False(ms.TryGetValue(out var _));

            var to = ms.Test();

            Assert.True(ms.HasObserver());
            Assert.False(ms.HasCompleted());
            Assert.False(ms.HasException());
            Assert.IsNull(ms.GetException());
            Assert.False(ms.HasValue());
            Assert.False(ms.TryGetValue(out var _));

            to.AssertSubscribed().AssertEmpty();

            ms.OnCompleted();

            Assert.False(ms.HasObserver());
            Assert.True(ms.HasCompleted());
            Assert.False(ms.HasException());
            Assert.IsNull(ms.GetException());
            Assert.False(ms.HasValue());
            Assert.False(ms.TryGetValue(out var _));

            to.AssertResult();

            ms.Test().AssertSubscribed().AssertResult();

            ms.Test(true).AssertSubscribed().AssertEmpty();
        }