X

Testing

Using dynamic type to test ASP.NET MVC controller actions returning JsonResult

I wrote unit tests for my ASP.NET MVC application that uses some jQuery AJAX-components. These components load data from server in JSON format. I needed to write tests for these methods to make sure that correct data is returned to client. In this posting I will show you how to use dynamic type to test JSON-based action results and therefore avoid creating DTO classes. (more…)

Invariant code contracts – using class-wide contracts

It is possible to define invariant code contracts for classes. Invariant contracts should always hold true whatever member of class is called. In this posting I will show you how to use invariant code contracts so you understand how they work and how they should be tested.

Code Contracts: Unit testing contracted code

Code contracts and unit tests are not replacements for each other. They both have different purpose and different nature. It does not matter if you are using code contracts or not – you still have to write tests for your code. In this posting I will show you how to unit test code with contracts.

The Mythical Man-Month

Yesterday I finished reading the classic project management book The Mythical Man-Month: Essays on Software Engineering by Frederick P. Brooks. Well… this book made me think a lot about nature of software projects, how primitive is our understanding about them and why managing such projects is usually hard fighting with a lot of different issues. The book has also interesting content from the past that is really interesting reading. To understand where you are you should know where you come from.

ExpectedException attribute in Visual Studio 2008 and Visual Studio 2010

Today I tried to write my first unit tests under Visual Studio 2010. Just to see if Visual Studio testing system can now also be used for unit tests. Visual Studio 2008 had some annoying problems with test and I preferred to use nUnit instead. Visual Studio 2010 brings some good news – tests work. Take a look at my example.