示例#1
0
        public void TestLoadPanguDict()
        {
            var mockPanguProviderSetting = new Mock<IDataProviderSetting>();
            mockPanguProviderSetting.Setup(s => s.Uri).Returns(UnitTestProjectFolder + @"\Data\panguDict.dct");
            mockPanguProviderSetting.Setup(s => s.ProviderType).Returns("PanguDictProvider");

            var panguProvider = new PanguDictProvider(mockPanguProviderSetting.Object);
            var dataList = panguProvider.Load();
            Assert.IsNotNull(dataList);
            Assert.AreEqual(146259, dataList.Count);
        }
示例#2
0
        public void TestLoadTrieTreeFromPanguDict()
        {
            var mockPanguProviderSetting = new Mock<IDataProviderSetting>();
            mockPanguProviderSetting.Setup(s => s.Uri).Returns(DictionaryLoadTest.UnitTestProjectFolder + @"\Data\panguDict.dct");
            mockPanguProviderSetting.Setup(s => s.ProviderType).Returns("PanguDictProvider");

            var panguProvider = new PanguDictProvider(mockPanguProviderSetting.Object);
            TrieTree tt = TrieFactory.LoadFromDataProvider(panguProvider);
            TrieTreeNode ttn = tt.GetNode("测试");
            Assert.IsNotNull(ttn);
            Assert.AreEqual(POSType.D_N, (POSType)ttn.POSValue);
        }