Skip to content

Instantly share code, notes, and snippets.

@kdhollow
Created February 24, 2016 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdhollow/e0f40ffae85e64ffdb50 to your computer and use it in GitHub Desktop.
Save kdhollow/e0f40ffae85e64ffdb50 to your computer and use it in GitHub Desktop.
Azure Search Test Initialization Code
private AzureSearchEngine azureSearchEngine;
private string indexName;
private string suggesterName;
private System.IO.Stream csvFile;
[TestInitialize]
public void Initialize()
{
indexName = ConfigurationManager.AppSettings["SearchServiceIndexName"];
suggesterName = ConfigurationManager.AppSettings["SearchServiceSuggesterName"];
var engines = new SearchEngines("SearchServiceName", "SearchServiceApiKey");
azureSearchEngine = engines.AzureSearchEngine;
csvFile = GetTestCsvFile();
}
private Stream GetTestCsvFile()
{
var assembly = Assembly.GetExecutingAssembly();
const string resourceName = "AFDSearch.Test.airports.csv";
return assembly.GetManifestResourceStream(resourceName);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment