예제 #1
0
        public void GetGroupByName_FindsGroupWithMatchingName_AndCaches()
        {
            var expectedGroup = new Channel {
                Id = "G1", Name = "foo", IsGroup = true
            };
            var otherGroup = new Channel {
                Id = "G2", Name = "bar", IsGroup = true
            };

            _api.Groups.List().Returns(new[] { otherGroup, expectedGroup });

            _sut.GetGroupByName("foo")
            .ShouldComplete()
            .And.ShouldBe(expectedGroup);
            _sut.GetGroupByName("foo")
            .ShouldComplete()
            .And.ShouldBe(expectedGroup);
            _api.Groups.Received(1).List();
        }
예제 #2
0
        public async Task GetGroupByName_FindsGroupWithMatchingName_AndCaches()
        {
            var expectedGroup = new Conversation {
                Id = "G1", Name = "foo", IsGroup = true
            };
            var otherGroup = new Conversation {
                Id = "G2", Name = "bar", IsGroup = true
            };

            _api.Conversations.List(types: IsOfAllConversationTypes()).Returns(ConversationList(otherGroup, expectedGroup));

            var result = await _sut.GetGroupByName("foo");

            result.ShouldBeA <Channel>()
            .And.Name.ShouldBe(expectedGroup.Name);
            _sut.GetGroupByName("foo")
            .ShouldComplete()
            .And.ShouldBe(result);
            await _api.Conversations.Received(1).List(types: IsOfAllConversationTypes());
        }