Example #1
0
File: Main.cs Project: itwymt/Kata5
 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();
 }
Example #2
0
 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>());
 }
Example #3
0
 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");
 }