Skip to main content


Getting Started with FakeItEasy

I've been writing unit tests for a long time now and let me tell you - writing good unit tests are really hard, especially when the system under test (SUT) has several dependencies that have some complex logic in them.  Some characteristics of good unit tests are: 1. Atomicity - It has to test one thing. 2. Deterministic - It should either Pass/Fail 3. Repeatable - Should yield the same result no matter how many times it runs. 4. Order Independent - Must be able to run in an isolated fashion 5. Fast - Run within milliseconds (in most cases) 6. Easy to Setup In order to meet these criteria, it's important to address the issues with dependencies. This is where test doubles or mocking frameworks come into the picture.  What is FakeItEasy? A .Net dynamic fake framework for creating all types of fake objects, mocks, stubs etc. Mock objects allow you to mimic the behavior of classes and interfaces, letting

Create custom keyboard shortcuts in Mac using Automator

Having been a windows user for the most part of my life - switching to a mac had its own sets of challenges, especially when it was going to be my go-to machine in terms of work and leisure. While I'm still getting used to the Mac environment, one thing that I miss, is the ability to create simple text files anywhere by right-clicking and selecting a menu option or a keyboard shortcut. Mac Automator to the rescue. Mac Automator lets you automate repetitive tasks by simply dragging built-in actions and creating a workflow to achieve a task. It also lets you define your own custom actions using AppleScripts. Firstly open the Automator  app in your mac and select File > New . Next, select the type of your document as Quick Action . Change the Workflow receives to - no input in Finder. Leave the rest of the options as it is. The top section should look like this    Next, add a javascript, in order to find the current location i

Unit Test Assertions on steroids - with Fluent Assertions

Unit testing has long been a key part of the software development life cycle, ensuring good quality of product and faster time to market. Adding them to our DevOps pipeline enables us to run unit tests in a consistent manner, based on a specified trigger. This allows us to detect errors in our code, early on in the process and prevents breaking of existing functionality in the future. All this sounds great, but imagine few months or years down the line, when some of the unit tests fail - will we be able to accurately assess the reason for the failure, and do so in a short period of time, so as to avoid any delays to our project release schedule. It's important to have clear and precise failure messages to help debug and fix the issues faster. The assert failure messages that most of the frameworks like NUnit or XUnit generate, are not easy to understand and might take developers a while to decode. Below is one such example. Expected : 12 But was : 11 A developer re

Building Cross-Platform Worker Services with .NET Core

If you have been in software development long enough, at some point you must have come across a need to have a long running background service. This came in the form of either windows services or daemons (for non windows systems). With the release of .NET Core 3.0, there is a new type of application template which was introduced to address the need of building cross-platform worker services. This could either be a Windows service or a systemd process that runs on Linux . You can either create the worker service using the Visual studio template as below Or use the command line and run command dotnet new worker The created project has the below file structure Program.cs   is the entry point for the application that registers and builds the host.  Worker.cs   file contains default worker. It inherits from   Microsoft.Extensions.Hosting.BackgroundService  class and overrides the  ExecuteAsync  method. Below is the Worker.cs code The code in  ExecuteAsync  

How I passed the 70-532 : Developing Microsoft Azure Solutions exam

To give you a little background, I have been considering to learn about cloud platforms for quite a while now. A few months back I created an account in Azure and started exploring the Azure portal. Since I have an enterprise account under the visual studio enterprise subscription, I get $150 monthly credits to play around with the various offerings that Azure provides. While I was exploring Azure, I came across the various certifications that Microsoft was offering, along with a huge discount (up to 40%), specifically on the Azure certification's, if registered on or before 30th June 2017. The cost was US $99 for one voucher / US $279 for three vouchers. This included - One exam with one retake (to be completed within 3 months for 1 voucher and 6 months for three vouchers) - A Microsoft Official Practice Test I went for the $99 Azure single pack, since the task of completing 3 certifications within 6 months seemed pretty daunting to me, considering the fact that I&#