public void PostInvalid()
        {
            var data  = _fixture.CreateMany <Message>().ToList();
            var count = data.Count;

            _mock.Setup(x => x.PutNewMessage(It.IsAny <Message>())).Callback((Message m) => data.Add(m));

            MessageWorker.Initialize(_mock.Object);
            MessageWorker.PutNewMessage(-1, null, null, null);
        }
        public void Send(string message)
        {
            if (message == "")
            {
                return;
            }
            var msg = new Message
            {
                User      = "******",
                UserId    = 1,
                Body      = message,
                TimeStamp = DateTime.Now,
                Channel   = "#general",
                MessageId = Guid.NewGuid().ToString()
            };

            Clients.All.addNewMessage(msg.ToString());
            MessageWorker.Initialize(new MessageDatabaseModel());
            MessageWorker.PutNewMessage(1, null, null, message);
        }
        public void PostValid()
        {
            var data  = _fixture.CreateMany <Message>().ToList();
            var count = data.Count;

            _mock.Setup(x => x.PutNewMessage(It.IsAny <Message>())).Callback((Message m) => data.Add(m));

            MessageWorker.Initialize(_mock.Object);
            MessageWorker.PutNewMessage(1, "user", "#reactive", "Improptu comments are hard to think of.");
            Assert.IsTrue(data.Count == ++count);
            MessageWorker.PutNewMessage(1, "user", "#reactive", "Improptu comments are hard to think of.");
            Assert.IsTrue(data.Count == ++count);
            MessageWorker.PutNewMessage(2, null, "#reactive", "Improptu comments are hard to think of.");
            Assert.IsTrue(data.Count == ++count);
            MessageWorker.PutNewMessage(3, "user", null, "Improptu comments are hard to think of.");
            Assert.IsTrue(data.Count == ++count);
            MessageWorker.PutNewMessage(3, "user", "#reactive", null);
            Assert.IsTrue(data.Count == ++count);
            MessageWorker.PutNewMessage(4, null, null, null);
            Assert.IsTrue(data.Count == ++count);
        }
 public void Post(string username, int id, string channel, string strVal)
 {
     MessageWorker.PutNewMessage(id, username, channel, strVal);
 }