<p>I wrote a savefile method to save an object to xml. But I am not sure how to test the method in NUnit. Do I need create a sample file manually and compare the string between the files? Are there any better ways to test the method?</p>

<p>Thanks for your answer.</p>

Here's what I do -- it works for me but it might not be to your specifications.
In the teardown I make sure I delete any files I might have created as part of the suite.  So yes, make sure the file is a scratch file just for testing
In the test method I delete the file if it exists (it shouldn't as the teardown has already taken care of it), then output the file to XML then assert the file exists.  I then reload the file either into an object graph or into the xml DOM and query the state through as many assertions as you need.
If you can get away with writing to files and your design allows you to write to a generic text writer or xml writer then you could bypass the file save and replace the calls with a string writer instead and just query a string.  Much cleaner but it doesn't test that the actual file persistence is working or not.