Yesterday I came across this question on StackOverflow:Is there a better way to ignore an exception in C# than putting it up in a try catch block and doing nothing in catch? I find this syntax to be cumbersome. For a code block, can't I simply "tag" it in such a way so as runtime … Continue reading How to ignore thrown exceptions
Tag: C#
Book review: C# in Depth, Second Edition
When I first picked up C# in Depth I was expecting to be bored. Although I wanted to read it I thought that most of the book will be introductory level C# programming such as you might expect from a book that teaches a single language. I was wrong! So if you’re looking for a … Continue reading Book review: C# in Depth, Second Edition
Find out where is the method that was called unexpectedly using fake objects
Every Isolation/Mocking framework out there can verify that a method of a fake object was called and not less important make sure that certain methods are not called. Let’s say that I want to make sure that a method didn’t encounter any errors during execution but verifying that logger.Error was not called: [TestFixture]public class MyClassTests{ … Continue reading Find out where is the method that was called unexpectedly using fake objects
How to: Invoke events inside your production code using Typemock Isolator
Using Isolate.Invoke.Event enable event driven unit testing by invoking events on fake or “real” object. If you use events to communicate between parts of your application – it’s a feature you need to know and use. In the last couple of months I have been using it a lot but there is one wall I … Continue reading How to: Invoke events inside your production code using Typemock Isolator
How to run IronPython code from C#
I’ve just got back from a joint session with Shay at the local .NET user group, I’ve presented IronPython after an excellent IronRuby session done by Shay. One example I didn’t have the time to show was how to run IronPython script from within C# code. After the session I was asked by a group … Continue reading How to run IronPython code from C#
Unit testing custom StyleCop rules using Typemock Isolator
I’ve never was a big fan of “coding standard” – Although I always thought that the same style should be kept throughout a project or even the entire company’s code base - the idea of forcing developers to write the same code based on a document nobody ever read seemed just wrong. Fast forward a … Continue reading Unit testing custom StyleCop rules using Typemock Isolator
Book review: Real-World Functional Programming
I’ve picked up Real-World Functional Programming because I wanted to learn F# and despite numerous attempts on my side I just couldn’t understand it. I understood the F# syntax and I knew how to write applications using F# but I just didn’t get it – I always thought that it was only suited for math … Continue reading Book review: Real-World Functional Programming
When to use the SetUp attribute
I want to share with you a debate we had at work today: Which one of the following is a better test – this one? [TestFixture]public class MyClassTests{ private MyClass myClass; [SetUp] public void Initialize() { var arg1 = //... var arg2 = //... // More initialization logic myClass = new MyClass(arg, arg2); } [Test] … Continue reading When to use the SetUp attribute
Poor C++ developer’s performance profiler
A while back I wrote a post about how I’ve used Stopwatch to profile .NET applications, this post is similar, it shows how “micro-benchmarking” can be done in C++ and more importantly it also shows how we can create a “using block” in C++. Update: Igal T. has written an excellent post on how … Continue reading Poor C++ developer’s performance profiler
Who’s afraid of C++
C++ is the 2nd programming language I’ve learned (C was the 1st) back in object oriented course and I’ve been using it ever since. From my first job where I’ve wrote code using Vim and XEmacs (for Linux - I’m not that old) to my current job where I’m using Visual Studio 2010 I’ve never … Continue reading Who’s afraid of C++
