public void RecentWebSocketMessage()
        {
            using (ShimsContext.Create())
            {
                var openEvent = default(EventHandler<EventArgs>);
                var messageEvent = default(EventHandler<StringEventArgs>);
                var messageEventFired = new ManualResetEvent(false);

                Guid appGuid = Guid.NewGuid();
                string text = "This is a log entry";
                string source = "app";

                string json = string.Format(@"{{""value"":{{""source"":""{0}"", ""app_guid"":""{1}"", ""text"":""{2}"", ""syslog"":{{ }} }} }}", source, appGuid.ToString(), text);

                Message msg = new Message();
                msg.Value = new MessageValue();
                msg.Value.AppGuid = appGuid;
                msg.Value.Text = text;
                msg.Value.Source = source;
                msg.Value.Syslog = new ValueSyslog();

                ShimLogyardWebSocket.AllInstances.StreamOpenedAddEventHandlerOfEventArgs = (@this, h) => openEvent = h;
                ShimLogyardWebSocket.AllInstances.DataReceivedAddEventHandlerOfStringEventArgs = (@this, h) => messageEvent = h;
                ShimLogyardWebSocket.AllInstances.OpenUriStringUriBoolean = (@this, appLogEndpoint, authenticationToken, proxy, skipCertValidation) => { };

                LogyardLog log = new LogyardLog(logyardEndpoint, string.Empty);
                log.MessageReceived += delegate(object sender, MessageEventArgs e)
                {
                    Assert.AreEqual(msg.Value.Source, e.Message.Value.Source);
                    Assert.AreEqual(msg.Value.AppGuid, e.Message.Value.AppGuid);
                    Assert.AreEqual(msg.Value.Text, e.Message.Value.Text);
                    messageEventFired.Set();
                };

                log.StartLogStream(msg.Value.AppGuid.ToString());

                messageEvent(this, new StringEventArgs() { Data = json });
                Assert.IsTrue(messageEventFired.WaitOne(100));
            }
        }
        public void RecentWebSocketErrorMessage()
        {
            using (ShimsContext.Create())
            {
                var openEvent = default(EventHandler<EventArgs>);
                var messageEvent = default(EventHandler<StringEventArgs>);
                var messageEventFired = new ManualResetEvent(false);

                Guid appGuid = Guid.NewGuid();
                string error = "This is a error";                

                string json = string.Format(@"{{""error"":""{0}""}}", error);

                Message msg = new Message();
                msg.Error = error;

                ShimLogyardWebSocket.AllInstances.StreamOpenedAddEventHandlerOfEventArgs = (@this, h) => openEvent = h;
                ShimLogyardWebSocket.AllInstances.DataReceivedAddEventHandlerOfStringEventArgs = (@this, h) => messageEvent = h;
                ShimLogyardWebSocket.AllInstances.OpenUriStringUriBoolean = (@this, appLogEndpoint, authenticationToken, proxy, skipCertValidation) => { };

                LogyardLog log = new LogyardLog(logyardEndpoint, string.Empty);
                log.ErrorReceived += delegate(object sender, ErrorEventArgs e)
                {
                    Assert.AreEqual(msg.Error, e.Error.Message);
                    messageEventFired.Set();
                };

                log.StartLogStream(appGuid.ToString());

                messageEvent(this, new StringEventArgs() { Data = json });
                Assert.IsTrue(messageEventFired.WaitOne(100));
            }
        }