public void channel_broadcasts_only_to_subbed_users() { IBackStore store = new BackStore(); store.Subscribe("user-1", "channel-1"); store.Subscribe("user-2", "channel-2"); var ret = store.PushBroadcast("user-1", "channel-1", "broadcast message"); Assert.Contains(store.UserMessages("user-1"), itm => itm.Id == ret.Item2); Assert.DoesNotContain(store.UserMessages("user-2"), itm => itm.Id == ret.Item2); }
public void broadcast_creates_message_other_users_can_see() { IBackStore store = new BackStore(); store.Subscribe("user-1", "channel-1"); store.Subscribe("user-2", "channel-1"); var ret = store.PushBroadcast("user-1", "channel-1", "broadcast message"); Assert.Contains(store.UserMessages("user-1"), itm => itm.Id == ret.Item2); Assert.Contains(store.UserMessages("user-2"), itm => itm.Id == ret.Item2); }
public void direct_message_sends_message_only_to_recipient() { IBackStore store = new BackStore(); var ret1 = store.PushDirect("user-1", "user-2", "DM 1"); var ret2 = store.PushDirect("user-2", "user-3", "DM 2"); Assert.Contains(store.UserMessages("user-2"), itm => itm.Id == ret1.Item2); Assert.Contains(store.UserMessages("user-3"), itm => itm.Id == ret2.Item2); Assert.DoesNotContain(store.UserMessages("user-2"), itm => itm.Id == ret2.Item2); Assert.DoesNotContain(store.UserMessages("user-3"), itm => itm.Id == ret1.Item2); }
public void direct_message_to_yourself() { IBackStore store = new BackStore(); var ret = store.PushDirect("user-1", "user-1", "DM yourself"); Assert.Contains(store.UserMessages("user-1"), itm => itm.Id == ret.Item2); }