Getting Started with FakeItEasy for Mocking and Unit Testing in .NET

When working with unit tests in C# and .NET, creating mock objects and simulating behaviors of dependencies are crucial steps. Enter FakeItEasy, a simple yet powerful mocking framework that can save you time and reduce boilerplate code. In this blog, we’ll dive into FakeItEasy and demonstrate its usage in a practical scenario involving C# 11 … Read more

Major performance issue of IEnumerable in C#/.NET

IEnumerable can be a performance bottleneck to your application if not used properly. In this blog post, first, I’m going to show how implementing IEnumerable the incorrect way can cause a performance bottleneck.  And after that, I’m going to show, how the performance issue can be fixed easily by using IEnumerable the proper way. The … Read more

Observer Pattern

The observer pattern is a design pattern from the Gang Of Four design patterns. And the observer pattern is a behavioral design pattern. The main intent of this pattern is to define a one-to-many dependency between objects so that when one object changes its state all the objects dependent on it are notified automatically. In … Read more

Iterator Pattern

The iterator design pattern is a behavioral design pattern. It is part of the Gang Of Four design patterns. The main intent of this design pattern is to provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation. In simple language, what the above statement means is that … Read more

Command Pattern

The command pattern is also one of the design patterns from the Gang Of Four design patterns. The command pattern is a behavioral design pattern. And the primary intent of this pattern is to encapsulate a request as an object, thereby letting us parameterize clients with different requests queue or log requests and support undoable … Read more

Nullable reference types in C# 8

Nullable reference types is the default behavior of reference types in C# 7.3 and below versions. Well, what do I mean by that? When we declare reference types, pre-C# 8, it’s always nullable, meaning it can be assigned a null value. Hence we need to check it against null to avoid NullReferenceException. The newly introduced … Read more

Entity Framework Core (A deep dive with SQL Server)

Entity Framework Core is the .Net Core version of Entity Framework. Which is an ORM (Object Relational Mapper) tool for .Net Framework to work with databases.Entity Framework Core has the following features, which differentiates it from the classic Entity Framework: It is cross-platform (by the virtue of being built for .Net Core) Extensible And lightweight … Read more

Unit testing with Machine.Specifications (aka MSpecs) and FakeItEasy – Continued

In the last post Unit testing with Machine.Specifications (aka MSpecs) and FakeItEasy, I have covered basic unit testing with MSpecs and FakeItEasy. Today first I am going to go through some more tests. And then I will cover the concepts of white-box testing with MSpecs and FakeItEasy. New tests for positive cases In the last … Read more

Unit testing with Machine.Specifications (aka MSpecs) and FakeItEasy

Unit testing is very critical for any application. In this blog post, I will walk through unit testing using Machine.Specifications (aka MSpecs) and FakeItEasy. The focus of unit testing is to test a unit of code in isolation of everything around it. Meaning we just test the method in questions and not the dependencies. Also … Read more

React.JS with ASP.Net Core SignalR

In my last post Real-Time Web Application in ASP.Net Core SignalR, I have covered real-time web application suing SignalR. For the web page, I used a plain HTML page, and just used Browser Console to write response from the SignalR stream. Today I will build an application using React.JS with ASP.Net Core SignalR. Today I will … Read more