I'm just beginning to study C# and, particularly, unit testing. So, here is part of the program, that logs various errors into a file.
/// <summary>
/// Logs error into File and/or EventLog
/// </summary>
/// <param name="moduleName">Module name where error occured</param>
/// <param name="error">Error description</param>
public void LogError(string moduleName, string error)
{
LogRecord(RecordTypes.Error, moduleName, error);
LogEvent(EventLogEntryType.Error, moduleName, "ERROR: " + error, 0);
}
I'm using Visual Studio 2008. I create a unit test, and it looks like
[TestMethod()]
public void LogErrorTest()
{
Logger_Accessor target = new Logger_Accessor(); // TODO: Initialize to an appropriate value
string moduleName = string.Empty; // TODO: Initialize to an appropriate value
string error = string.Empty; // TODO: Initialize to an appropriate value
int eventID = 0; // TODO: Initialize to an appropriate value
target.LogError("moduleName", error, eventID);
Assert.Inconclusive("A method that does not return a value cannot be verified.");
}
When I write something like "FooModule" instead of "Empty" in "string.Empty", it gives me an error CS0117 'string' does not contain a definition for 'FooModule'. What am I doing wrong?
Thank you for the answer.

New Topic/Question
Reply




MultiQuote



|