//-------------------------------------------------------------
        // 概要:指定URLから取得した掲示板名と想定結果を確認
        //-------------------------------------------------------------
        private void CheckBbsName(string url, string bbsName)
        {
            BbsStrategy strategy = BbsStrategyFactory.Create(url);

            strategy.UpdateBbsName();
            Assert.AreEqual(bbsName, strategy.BbsInfo.BbsName);
        }
Beispiel #2
0
        //-------------------------------------------------------------
        // 概要:コンストラクタ
        //-------------------------------------------------------------
        public OperationBbs()
        {
            // スレッドURL変更
            changeUrlWorker.WorkerSupportsCancellation = true;             // キャンセル処理を許可
            changeUrlWorker.DoWork += (sender, e) =>
            {
                string url = (string)e.Argument;
                strategy = BbsStrategyFactory.Create(url);
                strategy.UpdateBbsSetting();
                strategy.UpdateThreadList();
                strategy.UpdateBbsName();
            };
            changeUrlWorker.RunWorkerCompleted += (sender, e) =>
            {
                Logger.Instance.Debug("RaiseThreadListChange");
                ThreadListChange(this, new EventArgs());
            };

            // スレッド一覧更新
            updateThreadListWorker.WorkerSupportsCancellation = true;
            updateThreadListWorker.DoWork += (sender, e) =>
            {
                strategy.UpdateBbsSetting();
                strategy.UpdateThreadList();
            };
            updateThreadListWorker.RunWorkerCompleted += (sender, e) =>
            {
                Logger.Instance.Debug("RaiseThreadListChange");
                ThreadListChange(this, new EventArgs());
            };
        }
        public void BbsStrategyTest_ReadThread()
        {
            BbsStrategy       strategy   = BbsStrategyFactory.Create("http://jbbs.livedoor.jp/bbs/read.cgi/game/45037/1362306973/");
            PrivateObject     accessor   = new PrivateObject(strategy);
            List <ThreadInfo> threadList = (List <ThreadInfo>)accessor.Invoke("ReadThread", new object[] { });

            /*
             * // スレッド一覧数のチェック
             * Assert.AreEqual(threadTitleList.Length, threadList.Count);
             *
             * for (int i = 0; i < threadList.Count; i++)
             * {
             *      Assert.AreEqual(threadNoList[i], threadList[i].ThreadNo);
             *      Assert.AreEqual(threadTitleList[i], threadList[i].ThreadTitle);
             *      Assert.AreEqual(resCountList[i], threadList[i].ResCount);
             *      // TODO レス勢い取得:未実装 Assert.AreEqual(threadNoList[i], threadList[i].ThreadSpeed);
             * }
             */
        }
        //-------------------------------------------------------------
        // 概要:レス書き込みの想定結果確認
        //-------------------------------------------------------------
        private void CheckWrite(bool result, string url, string name, string mail, string text)
        {
            BbsStrategy strategy = BbsStrategyFactory.Create(url);

            try
            {
                strategy.Write(name, mail, text);
            }
            catch
            {
                if (result)
                {
                    Assert.Fail(string.Format("書き込みに失敗しました。\nname:{0}\nmail:{1}\ntext:{2}", name, mail, text));
                }
                return;
            }

            if (!result)
            {
                Assert.Fail(string.Format("スローされませんでした。\nname:{0}\nmail:{1}\ntext:{2}", name, mail, text));
            }
        }
Beispiel #5
0
        //-------------------------------------------------------------
        // 概要:生成されたストラテジのチェック
        //-------------------------------------------------------------
        private static void CheckStrategy(string url, Type type)
        {
            BbsStrategy strategy = BbsStrategyFactory.Create(url);

            Assert.AreEqual(type, strategy.GetType());
        }