예제 #1
0
        public void GetIms_FetchesOpenIms_AndCaches()
        {
            var im1 = new Im {
                Id = "D1"
            };
            var im2 = new Im {
                Id = "D2"
            };

            _api.Im.List().Returns(new[] { im1, im2 });

            _sut.GetIms()
            .ShouldComplete()
            .And.ShouldMatch(new[] { im1, im2 });
            _sut.GetIms()
            .ShouldComplete()
            .And.ShouldMatch(new[] { im1, im2 });
            _api.Im.Received(1).List();
        }
예제 #2
0
        public async Task GetIms_FetchesOpenIms_AndCaches()
        {
            var im1 = new Conversation {
                Id = "D1", IsIm = true
            };
            var im2 = new Conversation {
                Id = "D2", IsIm = true
            };
            var notAnIm = new Conversation {
                Id = "G1", IsMpim = true
            };

            _api.Conversations.List(types: IsOfAllConversationTypes()).Returns(ConversationList(im1, im2, notAnIm));

            var results = await _sut.GetIms();

            results.ShouldAllBeA <Im>()
            .And.ShouldOnlyContain(new[] { im1, im2 }, (im, co) => im.Id == co.Id);
            _sut.GetIms()
            .ShouldComplete()
            .And.ShouldOnlyContain(results);
            await _api.Conversations.Received(1).List(types: IsOfAllConversationTypes());
        }