/images/avatar.png

Tech Lead and AWS Developer

Top 5 Books for Software Developers

🔊 Voiced by Amazon Polly There are countless books for developers. Most are good. Some are great. And a few of them genuinely change the way you think and work. These are my five. 1. The Phoenix Project — Gene Kim, Kevin Behr & George Spafford A novel — not a textbook. The story of an IT manager tasked with saving a broken system while everything around him is on fire.

Fake Methods and Dependencies without Dependency Injection

🔊 Voiced by Amazon Polly Mocking via virtual method Fake Dependencies with an Interface and Dependency Injection is easy and the usual approach. But how can you fake without Dependency Injection or an Interface. I will show you two situations that came up in production code. Factory Method The first situation is a small AWS Lambda function with an http call. We want to mock the .Net HttpClient and write a UnitTest for our Request method.

Fake static property DateTime.Now() with a DateTime Provider

🔊 Voiced by Amazon Polly Our code is often time-dependent. We use the date or time to implement logic and make decisions in our code. The behavior of DateTime.Now or DateTime.UtcNow can differ due to the system, timezone and the time change (summer/winter). This means that we have to control this for our tests. Take this method for instance: public double ReturnCurrentOffset() { var result = DateTime.Now - DateTime.UtcNow; return result.