How do we validate arguments in unit tests?

Unit testing Everyone knows unit testing is an important but often forgotten part of software development. I’ve been there where it seems to be more convenient to leave out unit tests because we don’t have enough time to unit test a function or i tmight be just a bit too annoying to mock up some services to unit tests. However, over the years, I’ve grown to appreciate unit tests and what they do as it can help us avoid unnecessary bugs that can occur when we inadvertently edit a function and change the way it’s supposed to work....

August 21, 2021 · 4 min · Samuel Tambunan

What's new with C# 9?

C# 9 came out over a couple of years ago and only recently did I have a look into what actually changed. A bit late, but it’s always better to be late than never. The first thing that I got really excited about with c# 9 is the addition of the with expression. This seems to follow some javascript syntax that allows one object’s values to be copied very easily, and change a few properties if desired....

August 14, 2021 · 2 min · Samuel Tambunan

Singleton pattern

What’s the singleton pattern? A singleton pattern is an object creation pattern where only one instance of the object can ever be created in the lifetime of the application. In C#, this would be akin to having a static class as that would ensure there is only one instnace of the class for the application’s lifetime. public sealed class MessageService { public static MessageService SingletonMessageService { get; } = new MessageService(); // Auto implemented properties allow us to declare the singleton service in this manner private MessageService() { } } With the above example, there would always be only one instance of MessageService and the only way to use it is by calling it through MessageService....

August 8, 2021 · 3 min · Samuel Tambunan

What's new in .NET 6

.NET 6 .NET 6 should be released during .NET Conf 2021, which is between November 9 - 11. Currently, we can download previews for .NET 6 from the link. The idea for .NET 6 is to consolidate all the platforms that .NET currently has; Core, Framework, Standard, and unify them in one single framework. What’s new in .NET 6? Hot reload The hot reload function that will be introduced by ....

August 8, 2021 · 2 min · Samuel Tambunan

Facade patterns

I’ve been reading up on patterns recently and came across the facade pattern once again. I remember reading up on this a couple of years ago but never really understood it till now. I thought that the facade patterns was unnecessary as it will create unnecessary classes and complicate the solution. However, after playing around with it and having a better understanding of software development, I can now understand why a facade pattern can be quite useful....

July 27, 2021 · 2 min · Samuel Tambunan

Cross Wiring Dependency Injection

What is cross wiring? Cross wiring, in relation to Simple Injector and dependency injection, is the ability for Simple Injector’s dependency container to resolve services and dependencies from .NET Core’s built in configuration system. Service collection In our previous post with DI, DI with .NET 5, we discussed how dependency injection is built into the .NET Core’s framework and how services can be registered using the default built in container. This is done through the service collection and ....

July 24, 2021 · 3 min · Samuel Tambunan

Dependency injection with .NET Core

Dependency injection What is dependency injection? Dependency injection is a technique where services are injected through the constructor and interfaces are used over implementations when defining a class. It allows developers to follow the inversion of control guidelines and lossens the coupling between classes. Classes are always coupled to interfaces and not to implementations. This allows different implementations to be created and lossely couples the clasess. See link for more details....

July 22, 2021 · 4 min · Samuel Tambunan

.NET 5 API Controllers

API Controllers in .NET 5 needs to be implemented slightly differently than .NET Framework controllers. I’ll go over some of the few differences when creating a .NET 5 controller. Base controllers In .NET 5, there are two different ways of creating a controller. Creating an MVC controller is slightly different than creating an API controller. Let’s start off by creating the .NET 5 solution using the .NET Core CLI. dotnet new sln -n WebApiExamples dotnet new webapi -n WebApiStartup dotnet sln ....

July 19, 2021 · 3 min · Samuel Tambunan

Migrating to Hugo

I originally had a blog set up using Wordpress.com as it was easy to maintain and quite cheap for a 3 year deal. Now that the subscription has ended, I wanted to try a new method of hosting my blog. At first, I was going to use Umbraco and host it on App Services, but that became a bit too expensive as I would need to have SQL Server hosted somewhere....

HLS Part 2 - Http live streaming part 2

HLS Part 2 In the previous post, HLS Part 1, we gave an introduction to HLS and how it differs from traditional media servers. Let’s continue from where we left off and dive into how HLS works. Connecting to a primary playlist A URL is provided, let’s say it’s a master or a primary playlist. Say the primary playlist is provided in the endpoint: https://www.example.com/index.m3u8 When we query the HLS primary playlist, the response should be be a list of variant playlists or media playlists....

June 9, 2021 · 2 min · Samuel Tambunan