当前位置: 首页>>代码示例>>C#>>正文


C# Player.SetRedHeart方法代码示例

本文整理汇总了C#中System.Net.Player.SetRedHeart方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SetRedHeart方法的具体用法?C# Player.SetRedHeart怎么用?C# Player.SetRedHeart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Player的用法示例。


在下文中一共展示了Player.SetRedHeart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestSongNotSelectedException

        public async void TestSongNotSelectedException()
        {
            var playList = _defaultPlayList.DeepClone();
            var emptyPlayList = _defaultPlayList.DeepClone();
            emptyPlayList["song"] = new JArray();
            var serverConnectionMock = new Mock<IServerConnection>();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("playlist") && u.GetQueries().Contains(new KeyValuePair<string, string>("type", "n"))),
                It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(playList.ToString()).Verifiable();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("playlist") && u.GetQueries().Contains(new KeyValuePair<string, string>("type", "p"))),
                It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(playList.ToString()).Verifiable();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("playlist") && u.GetQueries().Contains(new KeyValuePair<string, string>("type", "s"))),
                It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(emptyPlayList.ToString()).Verifiable();

            var session = new Session(serverConnectionMock.Object);
            var player = new Player(session);
            await player.ChangeChannel(new Channel(0));
            await AssertEx.ThrowsAsync<NoAvailableSongsException>(async () => await player.Next(NextCommandType.SkipCurrentSong));
            Assert.IsNotNull(player.CurrentChannel);
            Assert.IsNull(player.CurrentSong);
            await AssertEx.ThrowsAsync<SongNotSelectedException>(async () => await player.SetRedHeart(true));
        }
开发者ID:alexguo88,项目名称:Kfstorm.DoubanFM.Core,代码行数:21,代码来源:PlayerTests.cs

示例2: TestNoAvailableSongs_SetRedHeart

        public async void TestNoAvailableSongs_SetRedHeart(bool redHeart)
        {
            var emptyPlayList = _defaultPlayList.DeepClone();
            emptyPlayList["song"] = new JArray();
            var serverConnectionMock = new Mock<IServerConnection>();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("playlist") && u.GetQueries().Contains(new KeyValuePair<string, string>("type", "n"))),
                It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.PlayList).Verifiable();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("playlist") && u.GetQueries().Contains(new KeyValuePair<string, string>("type", GetReportTypeStringByRedHeart(redHeart)))),
                It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(emptyPlayList.ToString()).Verifiable();

            var player = new Player(new Session(serverConnectionMock.Object));
            await player.ChangeChannel(new Channel(0));
            await AssertEx.ThrowsAsync<NoAvailableSongsException>(async () => await player.SetRedHeart(redHeart));
            serverConnectionMock.Verify();
        }
开发者ID:alexguo88,项目名称:Kfstorm.DoubanFM.Core,代码行数:15,代码来源:PlayerTests.cs

示例3: TestSetRedHeart

        public async void TestSetRedHeart(bool redHeart)
        {
            string reportType = GetReportTypeStringByRedHeart(redHeart);
            var serverConnectionMock = new Mock<IServerConnection>();
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("playlist")
                                                                  && u.GetQueries().Contains(new KeyValuePair<string, string>("type", "n"))),
                It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.PlayList).Verifiable();
            var session = new Session(serverConnectionMock.Object);
            var player = new Player(session);
            await player.ChangeChannel(new Channel(0));

            var originalSong = player.CurrentSong;
            serverConnectionMock.Setup(s => s.Get(It.Is<Uri>(u => u.AbsolutePath.EndsWith("playlist")
                                                                  && u.GetQueries().Contains(new KeyValuePair<string, string>("type", reportType))
                                                                  && u.GetQueries().Contains(new KeyValuePair<string, string>("sid", player.CurrentSong.Sid))),
                It.IsAny<Action<HttpWebRequest>>())).ReturnsAsync(Resource.PlayList).Verifiable();
            await player.SetRedHeart(redHeart);
            Assert.AreEqual(originalSong, player.CurrentSong);
            serverConnectionMock.Verify();
        }
开发者ID:alexguo88,项目名称:Kfstorm.DoubanFM.Core,代码行数:20,代码来源:PlayerTests.cs


注:本文中的System.Net.Player.SetRedHeart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。