예제 #1
0
        public void Logout_パスワードなし()
        {
            // arrange

            // act
            var actual = CavetubeAuth.Logout("CaveTalk", String.Empty, "C9A8B58F00CB4E88A8C884CD9C19B868");

            // assert
            Assert.Fail("例外が発生しませんでした。");
        }
예제 #2
0
        public void Logout_開発者キーなし()
        {
            // arrange

            // act
            var actual = CavetubeAuth.Logout("CaveTalk", "cavetalk", String.Empty);

            // assert
            Assert.Fail("例外が発生しませんでした。");
        }
예제 #3
0
        public void Logout_成功()
        {
            // arrange

            // act
            var actual = CavetubeAuth.Logout("CaveTalk", "cavetalk", "C9A8B58F00CB4E88A8C884CD9C19B868");

            // assert
            Assert.AreEqual(true, actual);
        }
예제 #4
0
        private void LogoutCavetube()
        {
            var apiKey = this.config.ApiKey;

            if (String.IsNullOrWhiteSpace(apiKey))
            {
                return;
            }

            var userId = this.config.UserId;

            if (String.IsNullOrWhiteSpace(userId))
            {
                throw new ConfigurationErrorsException("UserIdが登録されていません。");
            }

            var password = this.config.Password;

            if (String.IsNullOrWhiteSpace(userId))
            {
                throw new ConfigurationErrorsException("Passwordが登録されていません。");
            }

            var devKey = ConfigurationManager.AppSettings["dev_key"];

            if (String.IsNullOrWhiteSpace(devKey))
            {
                throw new ConfigurationErrorsException("[dev_key]が設定されていません。");
            }
            try {
                var isSuccess = CavetubeAuth.Logout(userId, password, devKey);
                if (isSuccess)
                {
                    this.config.ApiKey   = String.Empty;
                    this.config.UserId   = String.Empty;
                    this.config.Password = String.Empty;
                    this.config.Save();

                    base.OnPropertyChanged("LoginStatus");
                }
            } catch (WebException) {
                MessageBox.Show("ログアウトに失敗しました。");
            }
        }
예제 #5
0
 /// <summary>
 /// <see cref="ICavetubeAuth.Logout(string, string)"/>の説明参照
 /// </summary>
 /// <param name="userId"><see cref="ICavetubeAuth.Logout(string, string)"/>の説明参照</param>
 /// <param name="password"><see cref="ICavetubeAuth.Logout(string, string)"/>の説明参照</param>
 /// <returns><see cref="ICavetubeAuth.Logout(string, string)"/>の説明参照</returns>
 public bool Logout(string userId, string password)
 {
     return(CavetubeAuth.Logout(userId, password));
 }