Blog Archives

Burnout

My burnout turned out to be caused by a utter and complete boreout. Which I was in total denial from.

Yes, burnout doesn’t necessarily mean that you can handle high pressure, it can also be caused by not being stressed enough. And workload may not have anything to do with it at all.

Read more ›




Making sure all IWorker implementers call CanHandle from Handle without a mocking framework

lego-568039_1280

You have an interface that allows you to treat all worker classes – classes that handle a specific type of work – as just one type: IWorker;

You want your worker classes to be able to do their work without having to check their backs every step of the way.

Read more ›




How to verify a method actually gets called – without a mocking framework

hard-labor

Hard labor

You have busted your bum writing a solid MagnificentValidation validation method that checks the input data for a whole slew of data manipulation methods. And you, of course, covered it with unit tests so nobody, not even you, can accidentally mess up the validation logic without it being noticed.

Read more ›




4 surprises with asserts moving from Delphi to C#

QuestionMark_Exclamation-Point

Moving from Delphi to C# is fun most of the time.

Discovering stuff I can do in C# that is impossible, or (very) time consuming, in Delphi is fun. Discovering that stuff I take for granted in Delphi – i.e. metaclasses (officially “class references”),

Read more ›




How can you check a validation method is called if it just returns an error code

The strategy laid out in Testing strategy for validation and action methods calls for a single test per action method, to show that it actually calls the validation method.

With an exception throwing validation method that test is simple. But with error code returning validation –

Read more ›




Designing your way out of the CanHandle-Handle conundrum

CanHandle – Handle pattern conundrum

When you have multiple classes implementing an IWorker interface with a CanHandle and Handle method, such as

you find yourself in a conundrum: should you call CanHandle again from Handle?

If you don’t, someone could pass in work that a worker isn’t designed to handle and that can lead to a multitude of different exceptions or subtle,

Read more ›




Verify a validation method is called that doesn’t throw exceptions

The strategy laid out in Testing strategy for validation and action methods calls for a single test per action method, to show that it actually calls the validation method.

Validation methods throwing exceptions on invalid input provide you with a handy means of checking whether it has been called by your action methods.

Read more ›




Act like a pessimist and call CanHandle from Handle (again)?

You have multiple Worker classes that can each handle a one or more types of command. Your IWorker interface offers two methods: CanHandle and Handle.

Perfect.

Anyone with work to be done can now find a worker that says “yay, I can handle this” and then pass off the work to that worker.

Read more ›




Testing strategy for validation and action methods

How do you test a set of methods that call each other without repeating yourself unnecessarily?

You are more than tired of debugging “List index out of bounds”, “Duplicates not allowed” and similar exceptions. You want some help from your code so you don’t have to hit “Next” until you are blue in the face to figure out the information not contained in the standard exception messages.

Read more ›




Testing every implementer of an interface with the same tests using MSTest

You have an interface and multiple implementers of that interface. You want to test all those implementing classes using the same tests. And you do not want to repeat yourself. That would be … like … Gah!

Using NUnit that is a breeze. But you, you use MSTest,

Read more ›




Show Buttons
Hide Buttons