示例#1
0
        public void MessagereadedTest()
        {
            bool messageReaded = false;
            var  hub           = new ChatHub("*****@*****.**", "242424");
            var  mockClients   = new Mock <IHubCallerConnectionContext <dynamic> >();

            hub.Clients = mockClients.Object;
            dynamic all    = new ExpandoObject();
            dynamic others = new ExpandoObject();

            //all.broadcastMessage = new Action<string, string>((name, message) => {

            //});
            others.MessageReaded = new Action <UserViewModel, Guid>((user, messageID) => {
                messageReaded = true;
            });
            mockClients.Setup(m => m.All).Returns((ExpandoObject)all);
            mockClients.Setup(m => m.Others).Returns((ExpandoObject)others);
            hub.MessageReaded(new Guid("a2888ed6-394b-42b8-bd93-c0677d493f36"));
            Assert.IsTrue(messageReaded);
        }