Refactored NUnit export function

Now separated into several smaller functions, making it easier to spot the paired calls to WriteStartElement() and WriteEndElement(), etc.  Will make editing easier as we start to tweak the code to support our current "legacy" format alongside the updated version.