I'm writing a series of tests to validate code I'm writing. I want the documentation for the tests to list how the tests are finding errors. Instead of making sure the documentation gets updated with the tests I'd like to output the line of code. Is there a way to save it in a string?
The code would look like:
string Date = String.Format("Name = {0}, hours = {1:hh}", name, DateTime.Now);
string Code = ""Name = {0}, hours = {1:hh}", name, DateTime.Now"
Date
would be evaluated, while Code
would be the literal string. Something like:
string Date = string.Format(Code);