Пример #1
0
 public void should_check_if_message_sent()
 {
     //arrange
     var expected = "text";
     var sender = new MessageSender();
     string raisedMessage = null;
     sender.MessageAvailable += (obj, args) => raisedMessage = args.Message;
     //act
     sender.SendMessage(expected);
     //assert
     raisedMessage.Should().Be(expected);
 }
Пример #2
0
        public void should_check_all_structure()
        {
            //arrange
            var sender = new MessageSender();
            var server = new Server(new Encryptor());
            var recList = new List<MessageReceiver>();
            recList.AddRange(new[] {new MessageReceiver(), new MessageReceiver(), new MessageReceiver()});
            recList.ForEach(x=>x.Subscribe(server));
            //act
            server.Subscribe(sender);
            sender.SendMessage("ku");
            //assert

            recList.ForEach(x => Console.Out.WriteLine("Received: {0}", x.ReceivedMessage));
        }