all blog posts

JavaScript Testing: Jasmine customization

Make your Jasmine experience even more luscious with custom matchers and global convenience methods.
Mock global variables in your modules with jasmine.getGlobal().pi = 3.14.

5 Aug 2017
tutorial testing

JavaScript Testing: Jasmine async syntax

Need to test async code? No problem for Jasmine. There is done() to inform Jasmine a test has finished running.

With jasmine.clock(), the value of new Date() can be manipulated.

31 May 2017
tutorial testing

JavaScript Testing: Jasmine Spies

Spies, the Jasmine implementation for mocks featuring spyOn & spyOnProperty as well as jasmine.createSpy(Obj) and how to inspect calls made.

30 May 2017
tutorial testing

JavaScript Testing: Jasmine syntax

The basic example contains the general test suite structure and the two most used matchers toBe() (===) and toEqual() (deep compare), followed by all the other matchers that come out of the box.

To finish some helpers for your workflow: how to only have certain tests run and how to exclude tests.

30 May 2017
tutorial testing

JavaScript Testing: Getting started with Jasmine

Probably the most widely used JavaScript testing framework.

This tutorial covers installation, configuration and execution only. For the Jasmine syntax, see parts 2 to 4!

29 May 2017
tutorial testing

Create Excels with C# and EPPlus: Miscellaneous

Miscellaneous features

EPPlus can do a whole lot more for you. This post covers some interesting stuff that didn’t really fit anywhere else.

2 May 2017
excel tutorial

Create Excels with C# and EPPlus: Import

IEnumerable objects

Exporting data to an Excel doesn’t get easier than this

using (var package = new ExcelPackage())
{
	var sheet = package.Workbook.Worksheets.Add("IEnumerable");
	var data = new[]
	{
		new {Name = "A", Value = 1},
		new {Name = "B", Value = 2},
		new {Name = "C", Value = 3},
	};
	bool generateHeaders = true;
	sheet.Cells["A1"].LoadFromCollection(data, generateHeaders);

	// Overwrite headers with something fancier
	sheet.Cells["A1"].SetHeaders("Name", "Value");
	package.SaveAs(new FileInfo(@""));
}
1 May 2017
excel tutorial

NSubstitute vs Moq

Comparing NSubstitute syntax with Moq, probably the most used mocking framework out there at the moment.

moq/moq4 :

nsubstitute/nsubstitute :

30 Apr 2017
tutorial testing