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(); } }
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); } }