Browse by Tags

All Tags » .NET (RSS)

Getting started with Fake Objects – Part 3: Verify that a call has been made

If you haven’t read the other posts in this trilogy - you might what to have a look at them about now: Why fake is better then mock How to create a fake object Let’s begin the third part of this tutorial where I’ll explain what to do when we need to test that a method has been called. The problem at hand If you remember the code from the previous post we have UserService and we need to create a new user. In the last post I’ve explained how to fake the UserRepository so it will return the value we...

Why profiler API causes my .NET application to run as STA?

It seems I’m in a tip giving mood this week. I’d like to tell a story of a bug we had in Isolator…   Last a user complained about a bug that prevented one of VS2010 cronies to work properly. After investigating this issue he found out that using Isolator caused this code: [MTAThread()] static void Main( string [] args) { Console.WriteLine(Thread.CurrentThread.ApartmentState.ToString()); } To write STA on screen. It seems that running along with Isolator caused the thread apartment to transfer...
Posted by dhelper | with no comments

VS2010 Tip – How to run unit tests in 64bit process

One of the reason I used to prefer NUnit was that I could run my tests as x86 or x64 depending on what I needed. I was always strange that Microsoft unit testing framework didn’t have this ability. Luckily for use it seems that Microsoft heard our pain and decided to enable us to run our unit tests in 64bit context. And its very simple to enable – once you know it’s there. Just head to the test configuration (yep – Local.testsettings ) and under Hosts you can set if to run the tests as a 32bit or...

VS2010 tip: How to run unit tests in parallel

Running unit tests can take some time – at Typemock we have about 4,000 unit tests and running them takes 15 minuets. If you always wished it to take half the time (or a quarter of the time) – wait no more! Visual Studio 2010 has a hidden feature called parallel test execution – which means that you can run four tests at the same time on your quad core. Before you start make sure you don’t have any data collection/profiler active. Just go to the test settings (Local.testsettings file) under Data...

Getting started with Fake Objects – Part 2: How to create a fake object

In the previous post I’ve explained (briefly) what are fake objects and why they should be used – if you haven’t read it yet – I suggest you do so now. In  a nutshell fake objects are used to break dependencies in unit tests to make the test faster, predictable and enable you to test the un-testable. In this post I will show code! in fact we’re going to use isolation (Mocking) frameworks to create our very first fake object. I apologize in advance for using C# for my examples – just keep in...

How to run NUnit tests created with VS2010 and .NET 4

Today when writing tests for a new project built using VS2010 I had an interesting problem: NUnit would not run my unit tests because the assembly that contained my unit tests was compiled using a newer version of the .NET runtime. There are several solutions to solve this issue from downgrading my project to use earlier version of .NET to migrate my unit tests to MSTest but luckily for me no such drastic move was needed. The new NUnit (2.5.x) have support for running tests using .NET 4 it’s just...
Posted by dhelper | with no comments

Real world unit testing presentation

If you the Israel .NET Developers User Group (IDNDUG) and you’d like to learn more about unit testing you can view my presentation here . I talked about unit tests and how to write good unit tests in the first session. I had a lot of fun and I hope that so did my audience. Additional resources During the break and after the 2nd session (done by Gil Zilberfeld) some of the participants asked what addtioanl resources are available for developers who want to learn more about unit testing – so here they...

Book Review: WPF in Action with Visual Studio 2008

Introduction I was a bit worried when I first saw this book title – using visual studio version seems a bit over specified for my taste, reading the sub title made me even queasier - It looked as if the book will become obsolete in just a few months when VS2010 will be released. Today after reading WPF in Action I know that I will keep using it as a reference for many more years. This book is good for WPF beginners that want to learn how to make beautiful (and cool) user interface (UI) as well as...
Posted by dhelper | 2 comment(s)
תגים:, , ,

#Nose – the unit test discovery tool

One of the benefits of programming in C#/VB.NET is amount of tools available - from Visual Studio to build servers to unit testing frameworks it seems that there is a tool for every job. I thought that my .NET tool belt has everything I need until recently, while learning Python (actually IronPython) I’ve discovered Python-Nose (or Nose). Nose is one of these almost trivial tools that after using it for a while it’s impossible to go without it. All it does is find all your unit tests (in multiple...
Posted by dhelper | 1 comment(s)
תגים:, , , ,

This Week In Test Webcast

If you’ve been reading my blog you may have noticed that I’m not above self advertisement and this post is no different. At Typemock we’ve started a series of webcasts called “ this week in test ”, as you might have guessed we post a new episode each week. This is the place where two guys talk about interesting topics from blogosphere some even related to unit testing (and testing in general), software development, Agile and everything else interesting (to us). The first three webcasts were feature...
Posted by dhelper | with no comments

Five reasons to install Resharper 5 today

I’ve been using R# v5 for a few weeks (ever since the nightly builds were made public) and I’m not going back. There is an exception now and then but it get caught by R# and reported back (if you want it to) without causing any problems with Visual Studio. There are some feature I use more then others and that I really like, in fact I like them so much I want to writye about them here: It’s free I’m lucky - I work at a company that is willing to pay to make me more productive but in the past whenever...
Posted by dhelper | 1 comment(s)
תגים:, , ,

Poor developer’s performance profiler

In the last post I wrote about a simple method that can help .NET developers micro measure the memory consumption of their application, in this post I want to show a way to measure application performance. Before I start I want to state here and now that there is no substitute to using an actual profiling application that will can find performance bottlenecks and problematic code, but if you have a small piece of code that needs profiling or you have a good idea where your problems lie then keep...
Posted by dhelper | with no comments

Poor developer’s memory profiler

Some tools save you money. The rule of the thumb is that if you save X days using the tool and your salary is Y dollars (or whatever you get paid with) per day then the tool is worth X times Y - it’s that simple. Over the years I’ve used several tools to do performance profiling but I’ve never quite found a good memory profiler. Although there are some solid and effective memory profilers for .NET - they tend to run forever and the results they supply are less than optimal, using a memory profiler...
Posted by dhelper | 4 comment(s)

Free book for the tinkering developer

Have you ever taken a screwdriver to your TV just to find out how it works? Do you know how your computer looks form the inside? Ever pressed a button just to see what it does? Sounds familiar? probably because part of being a software developer (I assume you are a software developer) is finding out how things works. Reading code someone else wrote is part of our job. If you want to walk the extra mile and learn from monumental works of software development there is a book I recommend reading: Dissecting...
Posted by dhelper | 1 comment(s)
תגים:, , ,

Software News – October 2009

It’s that time in the month when I shed a light on cool tools releases that every (.NET) developer should know about. Visual Studio 2010 Beta 2 The new Visual Studio is one step closer to it’s release. Today MSDN subscribers (yours truly among them) can download the latest release of the upcoming 2010 version and it’s amazing, if you do not have MSDN subscription don’t worry Microsoft will release this version to the whole world to see soon. It has (almost) everything that a software developer needs...
Posted by dhelper | with no comments
תגים:, ,
More Posts Next page »