Example #1
0
        public void GetApiKeyTest()
        {
            var factory = new MockCavetubeAuthFactory();
            var mock    = factory.MockCavetubeAuth;

            mock.Setup(a => a.Login(It.IsAny <string>(), It.IsAny <string>())).Returns("apikey");
            ICavetubeAuth auth = mock.Object;

            using (CavetubeAuthManager manager = new CavetubeAuthManager("hakusai", "password", factory))
            {
                Assert.AreEqual("apikey", manager.GetApiKey());
            }

            mock.Verify(a => a.Logout("hakusai", "password"), Times.Once());
        }
Example #2
0
 /// <summary>
 /// テスト用コンストラクタ
 /// </summary>
 /// <param name="user">ユーザー名</param>
 /// <param name="password">パスワード</param>
 /// <param name="factory">認証に必要なオブジェクトのファクトリオブジェクト</param>
 public CavetubeAuthManager(String user, String password, ICavetubeAuthFactory factory)
 {
     _user = user;
     _pass = password;
     _auth = factory.CreateCavetubeAuth();
 }
Example #3
0
 /// <summary>
 /// テスト用コンストラクタ
 /// </summary>
 /// <param name="user">ユーザー名</param>
 /// <param name="password">パスワード</param>
 /// <param name="factory">認証に必要なオブジェクトのファクトリオブジェクト</param>
 public CavetubeAuthManager(String user, String password, ICavetubeAuthFactory factory)
 {
     _user = user;
     _pass = password;
     _auth = factory.CreateCavetubeAuth();
 }