I’ve been away from C++ for the last three years, this is the longest we’ve been apart.Luckily I’ve been given a chance to sharpen my skills and in the last few weeks I’ve been working exclusively in C++. During our time apart C++ has grown, and changed – this is not your father’s C++ it’s … Continue reading Why I like C++ 11 – auto & nullptr
Tag: C#
How to write a unit test
Last week I had the pleasure of participating in Sela Developer Practice. Before my session I sat through Gil ZIlberfeld’s session “7 steps for writing your first unit test” and I found myself thinking – what are steps I take when writing a new unit test?I’ve been writing them for so long and never noticed … Continue reading How to write a unit test
Unit testing multi threaded code–Timers
Writing unit tests for multi-threaded is not simple and could even be impossible for some scenarios – how could you test that an asynchronous method was not called?Since most unit testing examples tend to be rather trivial I’ve decided to try and explain other more complex scenarios – preferably without using any calculator examples.The “Timer” … Continue reading Unit testing multi threaded code–Timers
Things I learnt reading C# specifications (#1)
After reading Jon Skeet’s excellent C# in Depth - again (3rd edition - to be published soon) I’ve decide to try and actually read the C# language specification…Being a sensible kind of guy I’ve decided to purchase the annotated version which only cover topics up to .NET 4 – but has priceless comments from several … Continue reading Things I learnt reading C# specifications (#1)
Serialization and events in C#
Today I had an interesting problem:I was trying to serialize and object using BinaryFormatter but it kept on failing because some class was not Serializable. I’ve double and triple checked my class and all of it’s inner properties and verified that indeed they were marked correctly.The ProblemLooking closer at the exception I’ve noticed something – … Continue reading Serialization and events in C#
Making string based method strongly typed
I can't believe they implemented this way – was the first thought on my mind…The method in question is part of the new(er) NUnit’s constraint based model specifically the one used to assert a property value.Before we dive deeper a few words on the constraint based model:constraint based modelMost unit testing framework have similar way … Continue reading Making string based method strongly typed
Unit level BDD using SubSpec
In the BDD (Behavior Drive Development) there are two groups of frameworks. The first group contains tools such as SpecFlow and nBehave to name a few all of which uses (at least) two files – one contains the scenarios/behaviors in plain English (more or less) and the other the code that makes it all happen.I … Continue reading Unit level BDD using SubSpec
Fluent interfaces in C# – method chaining
For those of you who just tuned in, this is a third post on the subject of fluent interfaces using C#. In case you haven’t read them before – here are my previous posts on the subject:IntroductionExtension MethodsRight, now that we’re familiar with fluent interfaces it’s time to move to “Method Chaining”.Method chaining is the … Continue reading Fluent interfaces in C# – method chaining
Fluent Interfaces in C# – Extension Methods
FOr those of you who haven't read the previous post. This post is the 2nd of many where I explain how to use C# and a bag of tricks to create fluent interfaces – easily. In the previous post I’ve talked about what fluent interfaces is all about and gave a brief introduction to the … Continue reading Fluent Interfaces in C# – Extension Methods
Fluent Interfaces in C#–Introduction
Not many developers are familiar with the concept of DSLs (Domain Specific Languages) even fewer use them in their day job. It seems that creating a new language is a hard job that should only be left for professors in the academia or certain employees that work in Microsoft, Sun or some other compiler vendor. … Continue reading Fluent Interfaces in C#–Introduction