public void RemoveListener_CanBeCalledFromUpdate() { // Arrange var updateSource = new AsyncUpdateSource(); var observer = Substitute.For <IAsyncUpdatable>(); observer.When(x => x.Update(Arg.Any <float>())).Do(x => updateSource.RemoveListener(observer)); updateSource.AddListener(observer); // Act updateSource.OnNext(0); updateSource.OnNext(0); // Assert observer.Received(1).Update(Arg.Any <float>()); }
public void Dispose() { _parent.RemoveListener(_observer); }