Example #1
0
        public void GetConversationByName_FindsChannelWithMatchingName_AndCaches()
        {
            var expectedConversation = new Conversation {
                Id = "C1", Name = "foo"
            };
            var otherConversation = new Conversation {
                Id = "C2", Name = "bar"
            };

            _api.Conversations.List(types: IsOfAllConversationTypes()).Returns(ConversationList(otherConversation, expectedConversation));

            _sut.GetConversationByName("#foo")
            .ShouldComplete()
            .And.ShouldBe(expectedConversation);
            _sut.GetConversationByName("foo")
            .ShouldComplete()
            .And.ShouldBe(expectedConversation);
            _api.Conversations.Received(1).List(types: IsOfAllConversationTypes());
        }