Scott Thompson <easco / mac.com> wrote in message news:<7A98DD06-DEEC-11D7-ACB3-000393803090 / mac.com>...
> > Can you write some sort of
> > MockPostScript that records the commands it receives, and then you can
> > look into that in your unit test?
> 
> Unfortunately, the drawing context that the drawing commands play out 
> in is owned by the operating system and I don't have the ability to 
> duplicate it's functionality enough to create a mock drawing context 
> that could verify the points.  Perhaps I need to abstract the OS 
> drawing context one level (at least at testing time) then I could 
> insert my verification code in the intermediate layer between the 
> contour class and the operating system's drawing context.

I'd recommend doing this exactly. After a while, any system I've
worked on for a while ends up having abstractions for almost every
sort of external service -- I do a lot of database-backed web sites so
in my case this tends to be things like the filesystem, SMTP, CGI
field input, etc. Then you can write mock objects that mimic the
interface but just record the commands they receive so your unit tests
can ask what happened. This is more work up front, of course. But I
find this process essential to getting that feeling of confidence
testing gives you.

Francis