Tuesday, November 15, 2005

A Fool Such As I

Sometimes I doubt my intelligence when writing code. This morning I was working along, writing code and tests, running them in nUnit. I added a new test and some code and suddenly got an error in nUnit:

nunit-gui.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

If you were in the middle of something, the information you were working on might be lost.


I had the option to Debug or Close. I closed it, looked at my test and didn't see anything out of whack, so I tried it again. Same issue. So the next time I chose to Debug. I loaded it into my open copy of VS 2005 and got the message below.


This was on the code in my service that the unit test was calling. So I look at the code a little closer.


public DataSet GetPrimeInvoices(string employeeCode)

{

return this.GetPrimeInvoices(employeeCode);

}


See anything wrong with that?

The function I was calling was an overload of another function that took 2 parameters. I forgot to add the 2nd parameter to the call, so it was just calling itself until it crashed. I added the 2nd parameter

public DataSet GetPrimeInvoices(string employeeCode)

{

return this.GetPrimeInvoices(employeeCode, Level.ProjectManager);

}



I reran my tests and got the beautiful green dot...




Listening: Mr. Soul - Rush

No comments: