Exemplo n.º 1
0
 public void Send(Feed feed)
 {
     try
     {
         var s = JsonConvert.SerializeObject(feed);
         _log.InfoFormat("Publishing feed: '{0}'", s);
         _socket.Send(s);
     }
     catch (Exception e)
     {
         _log.Error(e);
     }
 }
Exemplo n.º 2
0
        public void Should_recieve_the_message()
        {
            var reset = new AutoResetEvent(false);
            var input = new Feed(new DateTime(2015, 01, 01), new List<string>() {"a", "b"});
            Feed result = null;
            _publisher.Send(input);

            _subscriber.OnFeedRecieved += delegate(Feed x)
            {
                result = x;
                reset.Set();
            };

            reset.WaitOne();

            Assert.AreNotSame(input, result);
            Assert.AreEqual(input.GeneratedOn, result.GeneratedOn);
            Assert.AreEqual(input.FeedData.Count(), result.FeedData.Count());
        }
Exemplo n.º 3
0
 public void Send(Feed feed)
 {
     _feed = feed;
     _reset.Set();
 }