Member-only story
Getting started with Unit Testing and Moq — Part 1
We had a new team lead start recently, he seems to have had a fair amount of experience in areas I’m only vaguely familiar with, mostly through reading. One of the first things being pushed for is a concentration on unit testing. While I did begin implementing some tests into our codebase a few months ago (around 250 so far), I feel that there’s still a long way to go. Luckily Chris is here to help impart knowledge to us, hooray!
So getting started with unit testing — first it should be defined what a unit test is from https://en.wikipedia.org/wiki/Unit_testing :
In computer programming, unit testing is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use.
Given the following classes/methods:
namespace RussUnitTestSample.Business.Interface
{
/// <summary>
/// Interface to get some numbers from the database
/// </summary>
public interface IDbGetSomeNumbers
{
/// <summary>
/// Get an array of doubles from the database
/// </summary>
/// <returns></returns>
double[] GetSomeNumbers();
}
/// <summary>
/// Interface for…