PageRenderTime 33ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/Source Code/UnitTests/Searching and Indexing/BaseSearchTester.vb

#
Visual Basic | 53 lines | 38 code | 15 blank | 0 comment | 0 complexity | 77110bde0662fc6a1bf40f856c951163 MD5 | raw file
  1. Imports System.Collections.Generic
  2. Imports Microsoft.VisualStudio.TestTools.UnitTesting
  3. Imports System.IO
  4. Imports PowerSong.FastSearching
  5. Public Class BaseSearchTester
  6. Private Shared FTemporaryFiles As New List(Of String)
  7. Protected Shared Function GetTemporaryFileName() As String
  8. Dim Result As String = Guid.NewGuid.ToString + ".Temp"
  9. FTemporaryFiles.Add(Result)
  10. Return Result
  11. End Function
  12. Protected Shared Sub RemoveTemporaryFiles()
  13. For Each FileName As String In FTemporaryFiles
  14. File.Delete(FileName)
  15. Next
  16. FTemporaryFiles.Clear()
  17. End Sub
  18. <CLSCompliant(False)> _
  19. Protected Shared Function CreateBasicIndex() As Indexer
  20. Dim Index As New Indexer
  21. Index.AddFileContentsToIndex("A", "Contents of first file.")
  22. Index.AddFileContentsToIndex("B", "Contents of second file.")
  23. Index.AddFileContentsToIndex("C", "Contents of third file.")
  24. Return Index
  25. End Function
  26. <CLSCompliant(False)> _
  27. Protected Shared Function CreateModerateIndex() As Indexer
  28. Dim Index As New Indexer
  29. Index.AddFileContentsToIndex("A", "This is the first file. ALL THREE TWO forceTop")
  30. Index.AddFileContentsToIndex("B", "This is the second file. ALL SIX")
  31. Index.AddFileContentsToIndex("C", "This is the third file. ALL SIX FIVE FOUR")
  32. Index.AddFileContentsToIndex("D", "This is the fourth file. ALL SIX FIVE FOUR THREE TWO ONE")
  33. Index.AddFileContentsToIndex("E", "This is the fifth file. ALL SIX FIVE FOUR")
  34. Index.AddFileContentsToIndex("F", "This is the sixth file. ALL SIX FIVE FOUR")
  35. Index.AddFileContentsToIndex("G", "This is the seventh file. ALL SIX FIVE THREE")
  36. Return Index
  37. End Function
  38. End Class