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_sends_only_direct_doesnot_touch_channel() { IBackStore store = new BackStore(); store.Subscribe("user-1", "channel-1"); store.Subscribe("user-2", "channel-2"); store.Subscribe("user-3", "channel-1"); store.Subscribe("user-3", "channel-2"); var ret1 = store.PushDirect("user-1", "user-2", "DM 1"); var ret2 = store.PushDirect("user-2", "user-3", "DM 2"); Assert.DoesNotContain(store.ChannelMessages("chanel-1"), itm => itm.Id == ret1.Item2); Assert.DoesNotContain(store.ChannelMessages("chanel-1"), itm => itm.Id == ret2.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); }
public void direct_message_creates_users() { IBackStore store = new BackStore(); var data = UserChannelData().ToList(); var u1ch1 = data[0]; var u2ch1 = data[1]; Assert.DoesNotContain(u1ch1[0], store.Users); Assert.DoesNotContain(u2ch1[0], store.Users); store.PushDirect(u2ch1[0], u1ch1[0], "direct message"); Assert.Contains(u1ch1[0], store.Users); Assert.Contains(u2ch1[0], store.Users); }