All 2 entries tagged Tdd
No other Warwick Blogs use the tag Tdd on entries | View entries tagged Tdd at Technorati | There are no images tagged Tdd on this blog
November 01, 2006
Nemerle, NUnit and custom operators
Nemerle allows the definition of new operators. I always feel annoyed having to write code like “Assert.AreEqual(42, myVal)” when unit testing with NUnit.
So I created this operator for use in my project’s test library:
namespace Equin.Vectorization.Library.Tests
module Utilities
public static @=!=[T](x : T, y : T) : void
Assert.AreEqual(x, y)
Now in my test cases I can use it like this:
[Test] public PixelAtTopLeft() : void
using (bmp = CreateBitmap(Size(10, 10), [Pt(0,0)]))
def ps = PixelSelector(bmp, Color.Black)
def pixels = ps.GetPixels()
mutable count = 0
mutable aPoint : Pt[int] = null
foreach (pt in pixels)
count++
aPoint = pt
1 =!= count
0 =!= aPoint.X
0 =!= aPoint.Y
It’s just sugar, I know, but it makes the assertions really jump out at me. It’s less to type as well :)
I could even make it a macro instead of a method call, that would then let me create a pretty message string as well…
June 27, 2006
Rhino Mocks Boo Macros Released
Writing about web page http://www.equin.co.uk/boo/rmbm.htm
My Boo syntactic macros for the Rhino Mocks mock object library are available to test. I've only spent a few days working on them but they are already powerful.
For download links and docs see preliminary documentation
Please wait - comments are loading

Loading…

