예제 #1
0
        public void GetMpIms_FetchesMpImList_AndCaches()
        {
            var mpim1 = new Channel {
                Id = "G1"
            };
            var mpim2 = new Channel {
                Id = "G2"
            };

            _api.Mpim.List().Returns(new[] { mpim1, mpim2 });

            _sut.GetMpIms()
            .ShouldComplete()
            .And.ShouldMatch(new[] { mpim1, mpim2 });
            _sut.GetMpIms()
            .ShouldComplete()
            .And.ShouldMatch(new[] { mpim1, mpim2 });
            _api.Mpim.Received(1).List();
        }
예제 #2
0
        public async Task GetMpIms_FetchesMpImList_AndCaches()
        {
            var mpim1 = new Conversation {
                Id = "G1", IsMpim = true
            };
            var mpim2 = new Conversation {
                Id = "G2", IsMpim = true
            };
            var notAnMpim = new Conversation {
                Id = "C1", IsChannel = true
            };

            _api.Conversations.List(types: IsOfAllConversationTypes()).Returns(ConversationList(mpim1, mpim2, notAnMpim));

            var results = await _sut.GetMpIms();

            results.ShouldAllBeA <Channel>()
            .And.ShouldOnlyContain(new[] { mpim1, mpim2 }, (ch, co) => ch.Id == co.Id);
            _sut.GetMpIms()
            .ShouldComplete()
            .And.ShouldOnlyContain(results);
            await _api.Conversations.Received(1).List(types: IsOfAllConversationTypes());
        }