public void Send_Multiple_Messages() { var watched = new Watched<string>(); var callCount = 0; watched.OnNext += (sender, e) => callCount ++; watched.Send("something"); watched.Send("something else"); Assert.AreEqual(2, callCount); }
public void Send_Errors_When_String_Is_Null() { var watched = new Watched<string>(); var wasErrorCalled = false; watched.OnError += (sender, e) => wasErrorCalled = true; watched.Send(null); Assert.IsTrue(wasErrorCalled); }
public void Send() { var watched = new Watched<string>(); var onNextCalled = false; watched.OnNext += (sender, e) => onNextCalled = true; watched.Send("something"); Assert.IsTrue(onNextCalled); }
public void Send() { var mockery = new MockRepository(); var subscriber = mockery.StrictMock<IObserver<string>>(); var message = "test message"; var watched = new Watched(); using (mockery.Record()) { subscriber.OnNext(message); } using (mockery.Playback()) using (var unsubscriber = watched.Subscribe(subscriber)) { watched.Send(message); } }
public void Send_Errors_When_String_Is_Null() { var mockery = new MockRepository(); var subscriber = mockery.StrictMock<IObserver<string>>(); string message = null; var watched = new Watched(); using (mockery.Record()) { subscriber.OnError(new Exception()); LastCall.Constraints(Is.TypeOf(typeof(ArgumentNullException)) && Property.Value("Message", "Unable to process null strings" + Environment.NewLine +"Parameter name: message")); } using (mockery.Playback()) using (var unsubscriber = watched.Subscribe(subscriber)) { watched.Send(message); } }