Unit Testing Using MOQ Framework

So to start with, most important Concept, that is misunderstood as an unnecessary task by most of the developers – Unit Testing!!! First, let us understand why it is very necessary for a developer to write unit test cases? Deployment: The most basic reason why test cases are written is, when we work in a team, many developers are contributing to the code base, and sometimes even on same modules. In such scenarios, if any developer checks-in a piece of code that breaks the functionality of certain module, unit test cases is the first line of call which alerts us about

Use Spring to run RSpec quicker

Use spring to run RSpec - with spring - bundle exec spring rspec spec/controllers/api/v1/ Finished in 47.14 seconds (files took 1.58 seconds to load) 72 examples, 0 failures without spring - bundle exec rspec spec/controllers/api/v1/ Finished in 48.84 seconds (files took 29.23 seconds to load) 72 examples, 0 failures One of the reasons for RSpec tests being slow is the initial application boot time. This happens every time you make changes in your code and takes few seconds every time. You can reduce that by using spring to run your

Interesting feature of Elixir: Documentation as Tests

One of the coolest feature I came across in Elixir - our code documentation becomes our unit tests. I was amazed by its simplicity when I saw it in action in sample app I was writing. I feel this is one of the most incredibly and helpful feature I saw in any modern programming language in recent times. (Python has similar functionality using Python’s doctest.) Let me explain this by giving a quick demo using few simple examples: Math functions sum and multiply. Lets say this is our Maths module defmodule Maths do def sum(num1, num2) do num1