What is technical debt really about?

When you think about the reasons for reducing technical debt; what do your think about? Read more here.

0

Evolution of a hand rolled fake – part 5

As you may know if you followed my blog before; I like to roll my own fake. For interfaces it is pretty straight forward with explicit implementation of the interface and properties with delegates for implementation. Read more here.

0

How would I test a WebAPI controller

Kind of related to my previous post, this article on how to test ASP.Net WebAPI controllers made me think. As you can see from the article it is fairly easy to get your controller under test, but it does take some work to get everything setup properly. And I have never tested my WebAPI controllers…

1

Evolution of a hand rolled fake – part 4

Another hard problem when it comes to creating fakes is when the interface contain overloads (i.e. same method name but different parameters) like this: 1: public interface IYetAnotherInterface 2: { 3: int DoSomething(); 4: int DoSomething(int x); 5: } The Fakes utility in VS11 will generate properties like DoSomethingInt32 and DoSometingInt32Int32. Not great names IMHO….

0

Evolution of a hand rolled fake – part 3

So how do I fake an interface with properties? 1: interface IAnotherInterface 2: { 3: int SomeProperty { get; } 4: int SomeOtherProperty { get; set; } 5: } Most of the time I just let my fake have the property implemented. This works most of the time but only really well if the interface…

0

Evolution of a hand rolled fake – part 2B

While the last version I showed is very flexible I have experimented a little more. Why would you ever have a public getter on the fake handler properties? Maybe if you had a fake that needed to wrap existing fake behavior but this is probably pretty rare. So this is what it would look like…

1

Evolution of a hand rolled fake – part 2

In a recent discussion at work I realized that the main reason I started with the constructor based fakes descried here was not to clutter the object with properties called SomethingHandler. By having my fake implement the interface explicitly I could create a fake like this: 1: public class FakeTheInterface : ITheInterface 2: { 3: public…

0

Evolution of a hand rolled fake

I usually hand roll my own fake objects for my tests. They have always looked a lot like what Stubs generate. I just think that it’s so cheap to create them that I don’t even need Stubs. In this series I’ll assume an interface that looks like this: 1: interface ITheInterface 2: { 3: void…

2

Dependency injection and good design

I helped preparing a meeting on dependency injection on my team and we had that meeting last week and it lead to a number of interesting discussions. Before we go into that I have to explain the title (which was the same as the title for this blog post). If you look at attributes people…

0

How object calisthenics can save the day

I recently talk to a friend who was migrating a large/complex system he wrote in J++ (ten years ago) to C#. The old system used integers and doubles for a lot of things like amount of money and number of months/days/years. Also over the years he’d learned that a lot of bugs came from the…

0