I'm using NUnit 262 and VS 2010.
This code should show messages writen with Debug.Writeline in the NUnit window, but it doen't.
The code:
public interface ILongRunningLibrary {
string RunForALongTime(int interval);
}
public class LongRunningLibrary : ILongRunningLibrary {
public string RunForALongTime(int interval) {
var timeToWait = interval * 1000; Thread.Sleep(timeToWait);
return string.Format("Waited {0} seconds", interval);
}
}
[TestFixture]
public class MoqExamples {
private Mock<ILongRunningLibrary> _longRunningLibrary;
[SetUp]
public void SetupForTest() {
_longRunningLibrary = new Mock<ILongRunningLibrary>();
}
[Test]
public void TestLongRunningLibrary() {
const int interval = 10;
var result = _longRunningLibrary.Object.RunForALongTime(interval);
Debug.WriteLine("Return from method was '" + result + "'");
}
[TearDown]
public void TearDownAfterTest() {
}
}
I should see this in the NUnit window:
But I see this instead: