PageRenderTime 75ms CodeModel.GetById 24ms RepoModel.GetById 7ms app.codeStats 0ms

/ESPSearchWebParts/ESPWebPartsUnitTest/src/mock/esp-search/ResultSpecificationMock.cs

#
C# | 449 lines | 365 code | 84 blank | 0 comment | 0 complexity | 1a0b7f60eddd01234f14c01290377e6a MD5 | raw file
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using Com.FastSearch.Esp.Search.View;
  7. namespace ESPWebPartsUnitTest.mock
  8. {
  9. class ResultSpecificationMock :IResultSpecification
  10. {
  11. private ArrayList fullsortEnabledFields;
  12. private ArrayList rankProfiles;
  13. public ResultSpecificationMock()
  14. {
  15. InitResultSpecificationMock();
  16. }
  17. private void InitResultSpecificationMock()
  18. {
  19. fullsortEnabledFields = new ArrayList();
  20. fullsortEnabledFields.Add(new SimpleFieldMock("field1"));
  21. fullsortEnabledFields.Add(new SimpleFieldMock("field2"));
  22. rankProfiles = new ArrayList();
  23. rankProfiles.Add(new RankProfileMock("default"));
  24. rankProfiles.Add(new RankProfileMock("rankprofile2"));
  25. }
  26. public bool IsNavigationEnabled()
  27. {
  28. return true;
  29. }
  30. public ArrayList GetNavigators()
  31. {
  32. throw new NotImplementedException();
  33. }
  34. public INavigator GetNavigator(string name)
  35. {
  36. throw new NotImplementedException();
  37. }
  38. public ArrayList GetNavigatorSets()
  39. {
  40. throw new NotImplementedException();
  41. }
  42. public INavigatorSet GetNavigatorSet(string name)
  43. {
  44. throw new NotImplementedException();
  45. }
  46. public INavigatorSet GetDefaultNavigatorSet()
  47. {
  48. throw new NotImplementedException();
  49. }
  50. public ArrayList GetResultViews()
  51. {
  52. throw new NotImplementedException();
  53. }
  54. public IResultView GetResultView(string name)
  55. {
  56. throw new NotImplementedException();
  57. }
  58. public IResultView GetDefaultResultView()
  59. {
  60. throw new NotImplementedException();
  61. }
  62. public ArrayList GetSortableFields()
  63. {
  64. throw new NotImplementedException();
  65. }
  66. public ArrayList GetFullsortEnabledFields()
  67. {
  68. return fullsortEnabledFields;
  69. }
  70. public ArrayList GetSummaryFields()
  71. {
  72. throw new NotImplementedException();
  73. }
  74. public ArrayList GetRankProfiles()
  75. {
  76. return rankProfiles;
  77. }
  78. public IRankProfile GetDefaultRankProfile()
  79. {
  80. throw new NotImplementedException();
  81. }
  82. public bool HasRankProfile(string name)
  83. {
  84. throw new NotImplementedException();
  85. }
  86. public bool IsClusteringEnabled()
  87. {
  88. throw new NotImplementedException();
  89. }
  90. public IClusteringSpecification GetClusteringSpecification()
  91. {
  92. throw new NotImplementedException();
  93. }
  94. public bool IsCategorizationEnabled()
  95. {
  96. throw new NotImplementedException();
  97. }
  98. public ICategorizationSpecification GetCategorizationSpecification()
  99. {
  100. throw new NotImplementedException();
  101. }
  102. public ArrayList Navigators
  103. {
  104. get;
  105. set;
  106. }
  107. public ArrayList NavigatorSets
  108. {
  109. get;
  110. set;
  111. }
  112. public INavigatorSet DefaultNavigatorSet
  113. {
  114. get;
  115. set;
  116. }
  117. public ArrayList ResultViews
  118. {
  119. get;
  120. set;
  121. }
  122. public IResultView DefaultResultView
  123. {
  124. get;
  125. set;
  126. }
  127. public ArrayList SortableFields
  128. {
  129. get;
  130. set;
  131. }
  132. public ArrayList FullsortEnabledFields
  133. {
  134. get { return fullsortEnabledFields; }
  135. }
  136. public ArrayList SummaryFields
  137. {
  138. get;
  139. set;
  140. }
  141. public ArrayList RankProfiles
  142. {
  143. get { return rankProfiles; }
  144. }
  145. public IRankProfile DefaultRankProfile
  146. {
  147. get;
  148. set;
  149. }
  150. public IClusteringSpecification ClusteringSpecification
  151. {
  152. get;
  153. set;
  154. }
  155. public ICategorizationSpecification CategorizationSpecification
  156. {
  157. get;
  158. set;
  159. }
  160. }
  161. class SimpleFieldMock:ISimpleField
  162. {
  163. private readonly string name;
  164. private readonly FieldType type;
  165. private ITokenizationSpecification tokenizationSpecification;
  166. private string defaultVectorization;
  167. private string alternativeVectorization;
  168. public SimpleFieldMock(string name)
  169. {
  170. this.name = name;
  171. type = FieldType.STRING;
  172. }
  173. public bool IsBoundaryMatchEnabled()
  174. {
  175. return true;
  176. }
  177. public bool IsSortable()
  178. {
  179. return true;
  180. }
  181. public bool IsFullsortEnabled()
  182. {
  183. throw new NotImplementedException();
  184. }
  185. public bool IsDynamic()
  186. {
  187. throw new NotImplementedException();
  188. }
  189. public bool IsTokenizationEnabled()
  190. {
  191. throw new NotImplementedException();
  192. }
  193. public ITokenizationSpecification GetTokenizationSpecification()
  194. {
  195. throw new NotImplementedException();
  196. }
  197. public bool IsVectorizationEnabled()
  198. {
  199. throw new NotImplementedException();
  200. }
  201. public string GetDefaultVectorization()
  202. {
  203. throw new NotImplementedException();
  204. }
  205. public string GetAlternativeVectorization()
  206. {
  207. throw new NotImplementedException();
  208. }
  209. public ITokenizationSpecification TokenizationSpecification
  210. {
  211. get { return tokenizationSpecification; }
  212. set { tokenizationSpecification = value; }
  213. }
  214. public string DefaultVectorization
  215. {
  216. get { return defaultVectorization; }
  217. set { defaultVectorization = value; }
  218. }
  219. public string AlternativeVectorization
  220. {
  221. get { return alternativeVectorization; }
  222. set { alternativeVectorization = value; }
  223. }
  224. public string GetName()
  225. {
  226. return name;
  227. }
  228. public new FieldType GetType()
  229. {
  230. return type;
  231. }
  232. public bool IsSimple()
  233. {
  234. throw new NotImplementedException();
  235. }
  236. public bool IsScope()
  237. {
  238. throw new NotImplementedException();
  239. }
  240. public bool IsComposite()
  241. {
  242. throw new NotImplementedException();
  243. }
  244. public bool IsFieldGroup()
  245. {
  246. throw new NotImplementedException();
  247. }
  248. public bool IsSearchable()
  249. {
  250. throw new NotImplementedException();
  251. }
  252. public bool IsSummaryField()
  253. {
  254. throw new NotImplementedException();
  255. }
  256. public bool IsLemmatizationEnabled()
  257. {
  258. throw new NotImplementedException();
  259. }
  260. public bool IsSubstringEnabled()
  261. {
  262. throw new NotImplementedException();
  263. }
  264. public string GetSubstring()
  265. {
  266. throw new NotImplementedException();
  267. }
  268. public string Name
  269. {
  270. get { return name; }
  271. }
  272. public FieldType Type
  273. {
  274. get { return type; }
  275. }
  276. public string Substring
  277. {
  278. get;
  279. set;
  280. }
  281. }
  282. class RankProfileMock : IRankProfile
  283. {
  284. private string name;
  285. public RankProfileMock(string name)
  286. {
  287. this.name = name;
  288. }
  289. public string GetName()
  290. {
  291. return name;
  292. }
  293. public int GetAuthorityWeight()
  294. {
  295. throw new NotImplementedException();
  296. }
  297. public IField GetAuthorityField()
  298. {
  299. throw new NotImplementedException();
  300. }
  301. public int GetFreshnessWeight()
  302. {
  303. throw new NotImplementedException();
  304. }
  305. public IField GetFreshnessField()
  306. {
  307. throw new NotImplementedException();
  308. }
  309. public int GetProximityWeight()
  310. {
  311. throw new NotImplementedException();
  312. }
  313. public int GetContextWeight()
  314. {
  315. throw new NotImplementedException();
  316. }
  317. public ArrayList GetContextFields()
  318. {
  319. throw new NotImplementedException();
  320. }
  321. public int GetFieldWeight(string fieldname)
  322. {
  323. throw new NotImplementedException();
  324. }
  325. public int GetFieldWeight(IField f)
  326. {
  327. throw new NotImplementedException();
  328. }
  329. public string Name
  330. {
  331. get { return name; }
  332. set { name = value; }
  333. }
  334. public int AuthorityWeight
  335. {
  336. get;
  337. set;
  338. }
  339. public IField AuthorityField
  340. {
  341. get;
  342. set;
  343. }
  344. public int FreshnessWeight
  345. {
  346. get;
  347. set;
  348. }
  349. public IField FreshnessField
  350. {
  351. get;
  352. set;
  353. }
  354. public IEnumerator CompositeRanks
  355. {
  356. get;
  357. set;
  358. }
  359. public IEnumerator ScopeRanks
  360. {
  361. get;
  362. set;
  363. }
  364. }
  365. }