Пример #1
0
        public async Task ShouldCellphoneLoginSuccess()
        {
            var api  = new NeteaseMusicSDK();
            var user = await api.LoginAsync(Configuration.Username, Configuration.Password);

            Assert.AreEqual(user.Name, Configuration.Nickname);
        }
Пример #2
0
        public async Task ShouldRecommendNotWorkWithoutLogin()
        {
            var api = new NeteaseMusicSDK();
            await Assert.ThrowsExceptionAsync <HttpRequestException>(api.RecommendAsync <Playlist>);

            api.Dispose();
        }
Пример #3
0
        public async Task ShouldLogoutWorks()
        {
            var api = new NeteaseMusicSDK();
            await api.LoginAsync(Configuration.Username, Configuration.Password);

            Assert.IsNotNull(api.Me);
            await api.LogoutAsync();

            Assert.IsNull(api.Me);
        }
Пример #4
0
        public async Task ShouldCookiePersist()
        {
            var storage = new Storage();
            var api     = new NeteaseMusicSDK(storage);
            var user    = api.Me ?? await api.LoginAsync(Configuration.Username, Configuration.Password);

            Assert.IsNotNull(user);
            api.Dispose();
            api = new NeteaseMusicSDK(storage);
            Assert.IsNotNull(api.Me);
            await api.RecommendAsync <Song>();
        }
Пример #5
0
 public static void AssemblyInitialize(TestContext context)
 {
     Api = new NeteaseMusicSDK(new Storage());
 }