Pages

Monday, July 31, 2017

Build your own C# search Engine using Azure Search

Azure Search is a Cloud service provided by Azure to enable an indexed search over any type of data you can create, It has filters abilities based on Lucene syntax and its has many of the features you would expect from Solr or ElasticSearch.

I will show you how to configure your service, and hot to get data in and perform searches over that data. We will skip the UI part, which you can build with your favorite tool. But I will show you the C# code to talk to the Azure Search Service.


Part 1 - Setup your Azure Search
For this you need an Azure Account, You can apply for a free one if you have a credit card to register. Once you have the Azure Account enter the azure portal:


Once there click the '+' sign to add a new service 
- Then on the search box  type: 'azure Search' and 'Enter'. 
- Then clic the 'Create' button on the lower part of the azure search tab.



Next lets put a name to our service this service can have more than one Index (or type of data) so lets make a general name for it. Select your subscription and click on 'Create'


Now you have to wait until the service its created. Once the service is created you will see it listed on your dashboard. enter the service by clicking on its name.

Friday, July 7, 2017

Make your own C# snippet to stub out Unit Tests

The point of snippets is to avoid repetitive typing and if you are currently creating unit tests, aren't you tired of writing arrange,act and assert ?

If you are like me, then the answer is Yes. And not only that but there are other areas that we can use to improve our coding experience. So take this as an introductory example to snippets, and lets create our unit test one.

What we wan to achieve is that after a couple of keystrokes we get this:


And the focus on the WhatAreAreTesting part of the function name so we can change it then one TAB press for ExpectedResult and then a final ENTER to get us to the arrange line so we can start coding.

A code snippet is just an XML file with an especific structure, you can create it in any text editor you want, in this case I will use Visual Sutio Code .

So lets open any Folder on VS Code:


then Add a new XML File: