Blog Archives

Why it pays to read more than just the first compiler message

Error messages are frustrating. Especially when you can’t figure out why you are getting them.

Take this bit of code:

It produces a ‘TestProject.ComparingCollections.SimpleDataAccessLayer_Tests.MountainComparer’ does not implement inherited abstract member ‘System.Collections.Generic.Comparer<ActualProject.ComparingCollections.Mountain>.Compare(ActualProject.ComparingCollections.Mountain, ActualProject.ComparingCollections.Mountain)’ error for the MountainComparer class.

Wah?

What do you mean?

Read more ›




Why it pays to invest some time learning the syntax and terminology of a language

Syntax is boring. Absolutely boring. So is theory and terminology. But neither is trivial. And neither is superfluous. Not if you want to get up to speed as quickly as possible.

Syntax differs from language to language. Everybody accepts that. Not everybody is as aware that while the concepts of object orientation are the same across object oriented languages,

Read more ›




Testing an abstract base class – code example

In the “How do I test an abstract base class if I can’t instantiate it?” post, you found out that you can actually test an abstract base class even though you can’t instantiate one.

The “all you need to do is” end of the post, however,

Read more ›




How does my mock know what value I want?

It is early afternoon. You just started your job at Glamorous Inc. Your buddy this morning talked about unit tests. How they want all code to have unit tests but also have code that was written before they started doing that. And they want you to start by getting some of that code under test.

Read more ›




How do I make a method use a different class in unit tests?

The code you work on has this wonderful simple method. All it does is use a couple of other classes, passing through the parameters it received and setting some properties.

As it is such a simple function nobody bothered to write any tests for it. After all, “It only passes through to another class.”

Read more ›




Why can’t my test access a public constructor?

It’s late in the afternoon. Almost time to go home. Just one issue to finish. A simple class that needs a couple of simple tests. Should be a breeze.

Five minutes later you are ready to bang your head against your desk. The error messages keep flying. And you can’t see why.

Read more ›




Show Buttons
Hide Buttons