18 Dec 2009, 21:53
Generic-user-small

henkcb (1 post)

I bought the book pragmatic Unit testing in C# with NUNIT , second edition isbn 10- 0-9776166-7-3

I installed NUNIT 2.5.3 ( instead of 2.4) and am trying to run my first unit test.

I get next problems with code on page 18 of the book:

using System; ` using NUnit.Framework;; using NUnit.Framework.SyntaxHelpers;`

[TestFixture] public class LargestTest { [Test] public void LargestOf3() {

int [] numbers; ` numbers = new int[] {8, 9, 7}; Assert.That(Cmp.Largest(new int[] {8,9,7}), Is.EqualTo(9));`

} }

I get 2 errors.

  1. it cannot find NUnit.Framework.SyntaxHelpers
  2. It cannot find Cmp

Issue 1 : I read that from version 2.5 onwards SyntaxHelpers is included in NUNIT Framework , so I can remove the line using NUnit.Framework.SyntaxHelpers; Please tell me if this is not the case.

Issue 2: Can someone tell where should NUNIT get the CMP-object from? Is there som reference I am missing? Should I do something else for version 2.53? Is there a document that compares version 2.4 with 2.5.3?

Thanks in advance for your help?

15 Mar 2010, 20:13
Netdev_pragsmall

Gareth Stephenson (6 posts)

Hi henkcb,

I know this reply is a couple months late, but better late than never!

It would seem you missed the Cmp class declaration on page 15. You have to write Cmp yourself, it’s not part of any library.

And yes, with NUnit 2.5.3, you can remove the SyntaxHelpers namespace from your using declarations, as it no longer exists within the new version of NUnit.

Cheers, Gareth.

  You must be logged in to comment