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); }
public void TestLoadTrieTreeFromPanguDict() { var mockPanguProviderSetting = new Mock<IDataProviderSetting>(); mockPanguProviderSetting.Setup(s => s.Uri).Returns(DictLoadTest.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); }