public void GetChannel_GetsChannelsFromRestAndCreateChannelObjects()
        {
            var baseUri = new Uri("http://localhost/");
            var channel = new Channel
            {
                ChannelId = CHANNEL1_ID
            };
            var channelObj     = new Mock <IChatChannel>();
            var restService    = Mock.Of <IRestService>();
            var channelFactory = new Mock <IChatChannelFactory>();

            channelFactory.Setup(
                x => x.NewInstance(restService, baseUri, TOKEN, USER_ID, TEAM_GUID, channel))
            .Returns(channelObj.Object);
            var sut = new SessionImpl(restService, baseUri,
                                      TOKEN, USER_ID, TEAM_GUID, channelFactory.Object, Mock.Of <IChatPostFactory>());

            var result = sut.GetChannel(CHANNEL1_ID);

            Assert.That(result, Is.EqualTo(channelObj.Object));
        }
Example #2
0
        public void GetChannel_GetsChannelsFromRestAndCreateChannelObjects()
        {
            var baseUri = new Uri("http://localhost/");
            var channel = new Channel
            {
                Id = CHANNEL_ID,
            };
            var channelObj     = new Mock <IChatChannel>();
            var restService    = Mock.Of <IRestService>();
            var channelFactory = new Mock <IChatChannelFactory>();

            channelFactory.Setup(
                x => x.NewInstance(restService, baseUri, TOKEN, TEAM_ID, channel))
            .Returns(channelObj.Object);
            var sut = new SessionImpl(restService, baseUri,
                                      TOKEN, TEAM_ID, channelFactory.Object, Mock.Of <IChatPostFactory>());

            var result = sut.GetChannel(CHANNEL_ID);

            result.ShouldBeEquivalentTo(channelObj.Object);
        }