The story so far: After reading Jon Skeet’s excellent C# in Depth - again I’ve decide to try and actually read the C# language specification…You can read about in a previous post of mine:Things I learnt reading C# specifications (#1)And so as I continue to read the C# specifications along with the excellent comments by … Continue reading Things I learnt reading C# specifications (2)
Tag: C#
What to do when FakeItEasy throws System.BadImageException
Today I had a weird problem at work. I’ve been working with a new team and they’ve been writing unit tests using FakeItEasy when they got a strange error message:System.BadImageFormatException: … The signature is incorrect.Now I’ve been using FakeItEasy for some time and I never once saw this strange behavior. Googling for the problem only … Continue reading What to do when FakeItEasy throws System.BadImageException
Faking a long running asynchronous call
A few days ago I needed to make sure that a specific method would only get called once no matter how many times it’s caller is invoked. The simplified code looked something like this:public async Task CallLongOperation(){ var result = await _client.LongWebCall(); if (result.Failed) { // log failure and exit } }I needed to make … Continue reading Faking a long running asynchronous call
Book review: Modern C++ Programming with Test-Driven Development
I’m always looking for ways to learn more about unit testing and TDD, I was elbow deep in a C++ project and I was looking to learn more about the tools & tricks of TDD in the unforgiving C++ world when this book was published and so I’ve started reading it. This book does … Continue reading Book review: Modern C++ Programming with Test-Driven Development
call_once for C#
One of the useful gems that made it into C++11 Standard Template Libraries (STD) is call_once, this nifty little method makes sure that specific code is called only once (duh) and it follows these 3 rules: Exactly one execution of exactly one of the functions (passed as f to the invocations in the group) is … Continue reading call_once for C#
Test Drive your windows phone application
Today I presented the topic of unit testing (surprise, surprise) and Test Driven Development for windows pone applications. I’d like to thank those who managed to arrive to the meeting despite the weather – it was a pleasure. My talk was at the second part of the meeting - right after Eyal who showed how … Continue reading Test Drive your windows phone application
On object creation and unit tests
There is always a balance between readability and maintainability when writing unit tests.I hate hearing a fellow developer say – “the task took me X time more because I had to fix 100+ tests because I refactored my production code”. This means I’m always on the look for ways to decrease the tests maintenance overhead.While … Continue reading On object creation and unit tests
Book Review: Async in C# 5.0 by Alex Davies
I’ve been hearing about async/await forever but didn’t really had a chance to use it until recently. After playing with asynchronous code for a while I felt I needed to close a few gaps in my understanding and so I looked for a book to provide me with the complete story. I’m glad I’ve found … Continue reading Book Review: Async in C# 5.0 by Alex Davies
C++ Bug hunt – shared_ptr misuse
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.from Bjarne Stroustrup's FAQ: Did you really say that?I want to share with you a strange bug I’ve been struggling with last week.I had an application that crashed whenever a user logged … Continue reading C++ Bug hunt – shared_ptr misuse
Simple Mocking in C++
I’ve been working in C++ for a few months now – after three years we’ve been apart.I always amazes me how simple things I took for granted do not exist (at least not out of the box) in C++, one of which are reflection.Two weeks ago I needed to make sure that a method was … Continue reading Simple Mocking in C++