Exemple #1
0
        public async Task AddGetConversations()
        {
            //this test assures the order of conversations
            await store.AddConversation(testConversation);

            await store.AddConversation(testConversation1);

            await store.AddConversation(testConversation2);

            await store.AddConversation(testConversation4);

            var conversations = await store.GetConversations(testConversation.Participants[0], null, null, 2);

            Assert.AreEqual(2, conversations.Conversations.Count);
            CollectionAssert.AreEquivalent(testConversation4.Participants, conversations.Conversations[0].Participants);
            CollectionAssert.AreEquivalent(testConversation1.Participants, conversations.Conversations[1].Participants);

            var PrevConversations =
                await store.GetConversations(testConversation.Participants[0], null, conversations.EndCt, 1);

            Assert.AreEqual(1, PrevConversations.Conversations.Count);
            CollectionAssert.AreEquivalent(testConversation.Participants, PrevConversations.Conversations[0].Participants);

            var PrevNullConversations =
                await store.GetConversations(testConversation.Participants[0], null, PrevConversations.EndCt, 2);

            Assert.AreEqual(0, PrevNullConversations.Conversations.Count);
            Assert.AreEqual(null, PrevNullConversations.StartCt);
            Assert.AreEqual(null, PrevNullConversations.EndCt);

            var NextConversations =
                await store.GetConversations(testConversation.Participants[0], PrevConversations.StartCt, null, 2);

            Assert.AreEqual(2, NextConversations.Conversations.Count);
            CollectionAssert.AreEquivalent(testConversation4.Participants, NextConversations.Conversations[0].Participants);
            CollectionAssert.AreEquivalent(testConversation1.Participants, NextConversations.Conversations[1].Participants);

            var NextNullConversations = await store.GetConversations(testConversation.Participants[0],
                                                                     NextConversations.StartCt, null, 2);

            Assert.AreEqual(0, NextNullConversations.Conversations.Count);
            Assert.AreEqual(null, NextNullConversations.StartCt);
            Assert.AreEqual(null, NextNullConversations.EndCt);
        }
 public async Task AddConversation_StorageUnavailable()
 {
     await store.AddConversation(testConversation);
 }