コード例 #1
0
        public void EndTransmission()
        {
            var watched = new Watched<string>();

            var onCompletedCalled = false;

            watched.OnCompleted += (sender, e) => onCompletedCalled = true;

            watched.EndTransmission();

            Assert.IsTrue(onCompletedCalled);
        }
コード例 #2
0
        public void EndTransmission()
        {
            var mockery = new MockRepository();
            var subscriber = mockery.StrictMock<IObserver<string>>();

            var watched = new Watched();

            using (mockery.Record()) {
                subscriber.OnCompleted();
            }

            using (mockery.Playback())
            using (var unsubscriber = watched.Subscribe(subscriber)) {
                watched.EndTransmission();
            }
        }