Example #1
0
        public async Task AddListMessages()
        {
            string conversationId = RandomString();
            var    dateTime       = DateTime.UtcNow;

            string userA = RandomString();
            string userB = RandomString();

            await store.AddConversation(new Conversation(conversationId, new[] { userA, userB }, dateTime));

            var messages = new[]
            {
                new Message("Hola what's up?", userA, dateTime.AddSeconds(1)),
                new Message("Not much you?", userB, dateTime.AddSeconds(2)),
                new Message("Writing some code!", userA, dateTime.AddSeconds(3)),
                new Message("Cool! Are you taking EECE503E?", userB, dateTime.AddSeconds(4))
            };

            foreach (var message in messages)
            {
                await store.AddMessage(conversationId, RandomString(), message);
            }

            List <Message> listedMessages   = (await store.ListMessages(conversationId, "", "", 50)).Messages.ToList();
            var            reversedMessages = messages.Reverse().ToList();

            CollectionAssert.AreEqual(reversedMessages, listedMessages);
        }
 public async Task AddMessage_NullMessage()
 {
     await store.AddMessage("foo", "bar", null);
 }