Beispiel #1
0
        public void AddListener_CanBeCalledFromUpdate()
        {
            // Arrange
            var updateSource = new AsyncUpdateSource();
            var observer     = Substitute.For <IAsyncUpdatable>();

            observer.When(x => x.Update(Arg.Any <float>())).Do(x => updateSource.AddListener(observer));
            updateSource.AddListener(observer);

            // Act
            updateSource.OnNext(0);
            updateSource.OnNext(0);

            // Assert
            observer.Received(3).Update(Arg.Any <float>());
        }
Beispiel #2
0
        public void OnNext_CallsUpdate()
        {
            // Arrange
            var updateSource = new AsyncUpdateSource();
            var observer     = Substitute.For <IAsyncUpdatable>();

            updateSource.AddListener(observer);

            // Act
            updateSource.OnNext(0);

            // Assert
            observer.Received().Update(0);
        }