private static void Main(string[] args) { var publisher = new Publisher(); var subsriberCreator = new SubscriberCreator(publisher); var commandProcessor = new CommandProcessor(publisher, subsriberCreator, Console.In); commandProcessor.SubscribeAndReadText(); Console.ReadLine(); }
public void test_add_subscriber_command() { var publisher = Substitute.For<IPublisher>(); var sc = Substitute.For<ISubscriberCreator>(); var st = new StringReader("add"); var cp = new CommandProcessor(publisher,sc,st); cp.SubscribeAndReadText(); sc.Received().CreateSubscriber(Arg.Any<TextWriter>()); }
public void test_reading_text() { var publisher = Substitute.For<IPublisher>(); var sc = Substitute.For<ISubscriberCreator>(); var sr = new StringReader("some text"); var cp = new CommandProcessor(publisher, sc, sr); cp.SubscribeAndReadText(); publisher.Received().Publish("some text"); publisher.DidNotReceive().Publish("some other text"); }