This tutorial demonstrates Structured Logging using Serilog with ElasticSearch serving as the backend log repository. This post is a follow up on the beginner post I wrote on Serilog. If you are a starter on Serilog then I will recommend that you give a quick read to that post. As usual I will start with… Read More »
This post on Faking Getters and Setters of Properties using FakeItEasy will help you to configure the behavior of the properties of the objects you fake. This is not as apparent as the various techniques on configuring the behavior of the methods of the faked objects. Getters and Setters are as configurable as regular methods… Read More »
This is c# based Specflow Step Definitions tutorial will explore intricacies of step definitions. This post follows the beginner tutorial I wrote before. I will recommend that you go through that before reading this post. Step definitions look simple but they have lot of hidden power. So without wasting any more time, let us as… Read More »
This c# based Specflow beginner tutorial will just focus on fundamentals to get you off to a quick start. At the end of this post you will be having a working Specflow solution. I will be writing other posts on Specflow which will highlight different aspects of Specflow. As usual I will discuss the WHY… Read More »
This post on Faking hardware using FakeItEasy is based on a simple premise. You should not suffer just because the function you are unit testing invokes some hardware. Writing hardware/device simulators used to be the way out. But with FakeItEasy, it is easy to fake your way out of this. So Let us see how… Read More »
This is a brief c# based tutorial on test builder pattern using fluent interface. It is one of the many ways we can tackle the problem of brittle tests. I will try to keep the example as real world as possible. As usual I will deal with the WHY before the HOW.
This is going to be a short tutorial (now updated for xUnit 2) on how to go about writing data driven tests using xUnit. The samples used will be easy to understand and relate to. In case you are new to xUnit then all I will say is that xUnit is the next iteration for… Read More »
Strict mocking vs Loose mocking is a question something which comes up often when various mocking frameworks like Moq, NSubstitute, Rhino Mocks, FakeItEasy are compared. So what is it? Suppose you create a fake of a class and do not configure the behavior of one of its method or property. Strict mocking: If the test… Read More »
There are many situations where you want to partially mock the class. You typically want to change the behavior of a single method in a class having many methods. So what you do is partial mocking. FakeItEasy and Partial Mocking go very well together.
Recently while writing unit tests for a device driver I came across a situation. I had to simulate the call to the device to wait for sometime and then throw an error and then check if I handled it properly. This helped. This configures the Start method (which in real life issues command to the… Read More »