Category Archives

2 Articles
Mocking objects with Moq and XUnit in .Net Core

Mocking objects with Moq and XUnit in .Net Core

Moq library 4.5 and above supports mocking objects in net Core. This article explains the step by step process that needed to Moq an object in net core. Mocking objects comes in handy when unit testing data store, where a Database can be mocked so that no data is added or modified in Database while unit testing source code.

Creating a test project

For the simplicity of explaining, I’m started with creating a XUnit test project in Visual Studio 2017 15.3

Add Moq package into the project

Read More

Dot net standard demystified: What, why and how?

Portable class Libraries and the Problem

In the beginning building applications for .Net was simple, developer had only one framework to target while building the application. This changed when Silverlight came. developers wanted to share libraries for Silverlight and .Net framework. Which caused the origin or Profiles.

Profiles

Profiles are a set of reference libraries, that have references to the libraries available in different platforms. In order to make sure any specific code can be portable, you can compile your code against to specific Profile.

  • Profile 14
  • .Net framework 4.0
  • Silverlight 5.0
  • Profile 37
  • Profile 14 (.Net framework 4.0 & Silverlight 5.0)
  • .Net framework 4.5

Read More