Exemplo n.º 1
0
        public void OnCompleted_CallsCompleted()
        {
            // Arrange
            var updateSource = new AsyncUpdateSource();
            var observer     = Substitute.For <IObserver <float> >();

            updateSource.Subscribe(observer);

            // Act
            updateSource.OnCompleted();

            // Assert
            observer.Received().OnCompleted();
        }
Exemplo n.º 2
0
        public void Unsubscribe_CanBeCalledFromOnCompleted()
        {
            // Arrange
            var updateSource = new AsyncUpdateSource();
            var observer     = Substitute.For <IObserver <float> >();
            var subscription = updateSource.Subscribe(observer);

            observer.When(x => x.OnCompleted()).Do(x => subscription.Dispose());

            // Act
            updateSource.OnCompleted();

            // Assert
            observer.Received(1).OnCompleted();
        }