Beispiel #1
0
        public void ホスト名からアドレスを取得する()
        {
            //setUp
            var sut = new DnsCache();
            const string expected = "59.106.27.208";

            //exercise
            var ipList = sut.GetAddress("www1968.sakura.ne.jp");
            var actual = ipList[0].ToString();

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #2
0
        public void アドレスからホスト名を取得する()
        {
            //setUp
            var sut = new DnsCache();
            var ip = new Ip("59.106.27.208");
            const string expected = "www1968.sakura.ne.jp";

            //exercise
            String actual = sut.GetHostName(ip.IPAddress, new Logger());

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #3
0
        public void 一度検索するとキャッシュ件数は1となる()
        {
            //setUp
            var sut = new DnsCache();

            const int expected = 1;

            //exercise
            sut.GetAddress("www.sapporoworks.ne.jp");
            var actual = sut.size();

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #4
0
        public void 無効なアドレスを検索するとアドレス表記がそのまま返される_タイムアウトに時間を要する()
        {
            //setUp
            var sut = new DnsCache();
            //InetAddress inetAddress = InetAddress.getByName("1.1.1.1");
            var ip = new Ip("1.1.1.1");

            const string expected = "1.1.1.1";

            //exercise
            TestUtil.WaitDisp("無効アドレスの検索 タイムアウトまで待機");
            var actual = sut.GetHostName(ip.IPAddress, new Logger());

            //verify
            Assert.That(actual, Is.EqualTo(expected));
            //TearDown
            TestUtil.WaitDisp(null);
        }
Beispiel #5
0
        //�N�����ɁA�R���X�g���N�^����Ăяo����鏉����
        private void DefaultInitialize(MainForm mainForm, ListView listViewLog, MenuStrip menuStrip, NotifyIcon notifyIcon)
        {
            RunMode = RunMode.Normal;
            RemoteConnect = null;//�����[�g����Őڑ�����Ă��鎞���������������

            //logger�����������܂ł̃��O��ꎞ�I�ɕۊǂ���
            //ArrayList<LogTemporary> tmpLogger = new ArrayList<>();

            //�v���Z�X�N�����ɏ����������
            View = new View(this, mainForm, listViewLog, notifyIcon);
            //logView = new LogView(listViewLog);
            LogView = new LogView(this,listViewLog);
            Menu = new Menu(this, menuStrip); //�����ł́A�I�u�W�F�N�g�̐����̂݁Amenu.Initialize()�́AlistInitialize()�̒��ŌĂяo�����
            DnsCache = new DnsCache();
            Wait = new Wait();

            Ver = new Ver(); //�o�[�W�����Ǘ�

            //Java fix
            //RunMode�̏�����
            if (mainForm == null){
                RunMode = RunMode.Service; //�T�[�r�X�N��
            } else{
                if (Environment.GetCommandLineArgs().Length > 1){
                    RunMode = RunMode.Remote; //�����[�g�N���C�A���g
                } else{
                    //�T�[�r�X�o�^�̏�Ԃ�擾����
                    var setupService = new SetupService(this);
                    if (setupService.IsRegist)
                        RunMode = RunMode.NormalRegist; //�T�[�r�X�o�^�������
                }
            }

            //Ver5.8.6 Java fix
            //OptionIni.Create(this); //�C���X�^���X�̏�����

            IniDb = new IniDb(ProgDir(), (RunMode == RunMode.Remote) ? "$remote" : "Option");

            MailBox = null;

            ListInitialize(); //�T�[�o�ċN���ŁA�ēx���s����鏉����

            if (_isTest){
                return;
            }

            //�E�C���h�T�C�Y�̕���
            var path = string.Format("{0}\\BJD.ini", ProgDir());
            try{
                //�E�C���h�E�̊O�ς�ۑ��E����(View���O�ɏ���������)
                WindowSize = new WindowSize(new Conf(ListOption.Get("Basic")), path);
                View.Read(WindowSize);
            } catch (IOException){
                WindowSize = null;
                // �w�肳�ꂽWindow���ۑ��t�@�C��(BJD.ini)��IO�G���[���������Ă���
                _logger.Set(LogKind.Error, null, 9000022, path);
            }

            //TraceDlg = new TraceDlg(this, (mainForm != null) ? mainForm.getFrame() : null); //�g���[�X�\��
            TraceDlg = new TraceDlg(this); //�g���[�X�\��

            switch (RunMode){
                case RunMode.Normal:
                    MenuOnClick("StartStop_Start"); //���j���[�I��C�x���g
                    break;
                case RunMode.Remote:
                    RemoteClient = new RemoteClient(this);
                    RemoteClient.Start();
                    break;
                //Java fix Ver5.8.3
                case RunMode.NormalRegist:
                case RunMode.Service:
                    break;
                default:
                    Util.RuntimeException("Kernel.defaultInitialize() not implement (RunMode)");
                    break;
            }

            //Java fix Ver5.8.3
            View.SetColor();//�E�C���h�F�̏�����
        }
Beispiel #6
0
        public void 無効なホスト名を検索すると0件の配列が返される_タイムアウトに時間を要する()
        {
            //setUp
            var sut = new DnsCache();

            const int expected = 0;

            //exercise
            TestUtil.WaitDisp("無効ホスト名の検索 タイムアウトまで待機");
            var ipList = sut.GetAddress("xxx");
            var actual = ipList.Count();

            //verify
            Assert.That(actual, Is.EqualTo(expected));
            //TearDown
            TestUtil.WaitDisp(null);
        }