public async void TestGetChannelInfo() { var serverConnectionMock = new Mock <IServerConnection>(); serverConnectionMock.Setup(s => s.Get(It.Is <Uri>(u => u.AbsolutePath.EndsWith("channel_info")), It.IsAny <Action <HttpWebRequest> >())).ReturnsAsync(Resource.ChannelInfoExample).Verifiable(); var discovery = new Discovery(new Session(serverConnectionMock.Object)); var channel = await discovery.GetChannelInfo(123); Validator.ValidateChannel(channel); serverConnectionMock.Verify(); }
public async void TestGetChannelInfo(string query) { var player = Generator.Player; var discovery = new Discovery(player.Session); var channels = await discovery.SearchChannel(query, 0, 1); Assert.IsNotNull(channels); Assert.AreEqual(1, channels.CurrentList.Count); Assert.GreaterOrEqual(channels.TotalCount, 1); var channel = channels.CurrentList[0]; Validator.ValidateChannel(channel); await player.ChangeChannel(channel); Validator.ValidateSong(player.CurrentSong); var songDetail = await discovery.GetSongDetail(player.CurrentSong.Sid); Assert.IsNotNull(songDetail); Assert.IsNotNull(songDetail.SimilarSongChannel); channel = await discovery.GetChannelInfo(songDetail.SimilarSongChannel.Value); Validator.ValidateChannel(channel); Assert.AreEqual(songDetail.SimilarSongChannel.Value, channel.Id); Assert.IsNotEmpty(songDetail.ArtistChannels); foreach (var artistChannel in songDetail.ArtistChannels) { var newChannel = await discovery.GetChannelInfo(artistChannel.Id); Validator.ValidateChannel(newChannel); Assert.AreEqual(artistChannel.Id, newChannel.Id); Assert.AreEqual(artistChannel.Name, newChannel.Name); Assert.AreEqual(artistChannel.CoverUrl, newChannel.CoverUrl); Assert.AreEqual(artistChannel.Description, newChannel.Description); } }
public async void TestGetChannelInfo() { var serverConnectionMock = new Mock<IServerConnection>(); serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("channel_info")), It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.ChannelInfoExample).Verifiable(); var discovery = new Discovery(new Session(serverConnectionMock.Object)); var channel = await discovery.GetChannelInfo(123); Validator.ValidateChannel(channel); serverConnectionMock.Verify(); }