public void SearchAll()
        {
            var service = new JapanPostSearchService(Path.Combine(RootDirectory, "TestResult", "Services",
                                                                  "JapanPostSearchService", "SearchAll"));

            service.CreateIndex();
            var recordShibuya = service.SearchRecord("渋谷").ToList();
            var recordTokyoto = service.SearchRecord("東京都").ToList();
        }
Exemple #2
0
        /// <summary>
        /// プログラムのメインエントリ
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            var storagePath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "storage");
            var service     = new JapanPostSearchService(storagePath);

            switch (args.Length)
            {
            case 0:
                Console.WriteLine("インデックスの作成を開始します。");
                service.CreateIndex();
                Console.WriteLine("インデックスの作成が完了しました。");
                break;

            case 1:
                Console.WriteLine("検索を実行します。");
                foreach (var text in service.SearchRecord(args[0]))
                {
                    Console.WriteLine(text);
                }

                Console.WriteLine("検索結果が出力されました。");
                break;

            default:
                Console.WriteLine("引数を2つ以上指定しないでください。");
                break;
            }
        }
Exemple #3
0
        public void SearchInputIllegalCase()
        {
            var service = new JapanPostSearchService(Path.Combine(TestSetup.RootDirectory, "TestResult", "Services",
                                                                  "JapanPostSearchService", "CreateIndex"));

            service.CreateIndex();
            var records = service.SearchRecord("ダミー").ToList();

            Assert.IsFalse(records.Any());
        }
Exemple #4
0
        public void SearchInputCase2()
        {
            var service = new JapanPostSearchService(Path.Combine(TestSetup.RootDirectory, "TestResult", "Services",
                                                                  "JapanPostSearchService", "SearchInputCase2"));

            service.CreateIndex();
            var records = service.SearchRecord("東京都").ToList();

            Assert.IsTrue(records.Any());
            foreach (var record in records)
            {
                Assert.IsTrue(record.Contains("東京"));
                Assert.IsTrue(record.Contains("京都"));
            }
        }
 public void SearchInputCase2()
 {
     var service = new JapanPostSearchService(SearchIndexPath());
     var records = service.SearchRecord("東京都").ToList();
 }