public void Setup() { string[] arrayOfStrings = TestDataRetrievalService.GetMThesaurStringArray(); dict = new Dictionary <int, string>(arrayOfStrings.Length); int upperBound = arrayOfStrings.Length; for (int i = 0; i < upperBound; i++) { dict.Add(i, arrayOfStrings[i]); } idict = (IDictionary <int, string>)dict; }
public void GlobalSetup() { arrayOfStrings = TestDataRetrievalService.GetMThesaurStringArray(); int upperBound = arrayOfStrings.Length; listOfProducts = new List <Product>(upperBound); for (int i = 0; i < upperBound; i++) { listOfProducts.Add(new Product() { Id = i + 100, Name = arrayOfStrings[i] }); } }
public void GlobalSetup() { arrayOfStrings = TestDataRetrievalService.GetCommonWordsTestData(); RandomizerUtil.Shuffle(arrayOfStrings); int upperBound = arrayOfStrings.Length; listOfProducts = new List <Product>(upperBound); dictionaryIndexByName = new Dictionary <string, Product>(upperBound); sortedDictionaryIndexByName = new SortedDictionary <string, Product>(); trieIndexByName = new TernarySearchTrie <Product>(); for (int i = 0; i < upperBound; i++) { var product = new Product() { Id = i + 100, Name = arrayOfStrings[i] }; listOfProducts.Add(product); dictionaryIndexByName.Add(product.Name, product); trieIndexByName.Put(product.Name.AsSpan(), product); sortedDictionaryIndexByName.Add(product.Name, product); } var random = new Random(); int searchStringsUpperBound = 10000; arrayOfRandomSearchStrings = new List <string>(searchStringsUpperBound); for (int i = 0; i < searchStringsUpperBound; i++) { int randomIndex = random.Next(0, upperBound - 1); string randomString = arrayOfStrings[randomIndex]; if (randomIndex % 2 == 0) { arrayOfRandomSearchStrings.Add(randomString.Reverse().ToString()); } else { arrayOfRandomSearchStrings.Add(randomString); } } }
public void Setup() { arrayOfStrings = TestDataRetrievalService.GetCommonWordsTestData(); }
public void Setup() { arrayOfStrings = TestDataRetrievalService.GetMThesaurStringArray(); }