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