Пример #1
0
        public void should_put_messages_on_separate_lines()
        {
            Event avail = new Event("avail");
            adapter.AddDataItem(avail);
            avail.Value = "AVAILABLE";

            Message msg = new Message("message");
            adapter.AddDataItem(msg);
            msg.Value = "Message";
            msg.Code = "123";
            adapter.SendChanged();

            adapter.addClientStream(stream);

            stream.Seek(0, SeekOrigin.Begin);
            byte[] buffer = new byte[1024];
            int count = stream.Read(buffer, 0, 1024);

            String s = encoder.GetString(buffer, 0, count);
            string[] lines = s.Split('\n');
            Assert.AreEqual(3, lines.Length);
            Assert.IsTrue(lines[0].EndsWith("avail|AVAILABLE"));
            Assert.IsTrue(lines[1].EndsWith("message|123|Message"));
            Assert.AreEqual(0, lines[2].Length);
        }
Пример #2
0
 public void setup()
 {
     e = new Event("test");
     m = new Message("m");
 }