예제 #1
0
        public void GetConversationByUserId_OpensImWithUser_AndCaches()
        {
            var expectedIm = new Conversation {
                Id = "D123", User = "******", IsIm = true
            };

            _api.Conversations.List(types: IsOfAllConversationTypes()).Returns(ConversationList());
            _api.Conversations.OpenAndReturnInfo(UserIds(expectedIm.User)).Returns(new ConversationOpenResponse {
                Channel = expectedIm
            });

            _sut.GetConversationByUserId(expectedIm.User)
            .ShouldComplete()
            .And.ShouldBe(expectedIm);
            _sut.GetConversationByUserId(expectedIm.User)
            .ShouldComplete()
            .And.ShouldBe(expectedIm);
            _api.Conversations.Received(1).OpenAndReturnInfo(UserIds(expectedIm.User));
        }