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

Using Environment Variables in XUnit

When I was creating unit tests for a .NET Core lambda, I had to be able to unit test with the Environment.GetEnvironmentVariable(). The best practice would have been to decouple this and have an IEnvironmentService which would be able to get all the values out. This way, you would be able to mock out the IEnvironmentService to retrieve values. However, as I wasn’t able to do this, due to the limitations of the current project and timelines, I had to use Environment....

October 3, 2019 · 1 min · Samuel Tambunan