Hi
Sure you can do that but not through the mockProcess instance.
Just mock the ProcessStartInfo and expect the FileName property.
public void Test()
{
Mock<ProcessStartInfo> mockStartInfo = MockManager.Mock<ProcessStartInfo>();
mockStartInfo.ExpectGet("FileName", "test");
Process proc = new Process();
Assert.AreEqual(proc.StartInfo.FileName, "test");
MockManager.Verify();
}
Or you can do it in natural mocks which is well... more natural :wink:
[Test]
public void Test()
{
using(RecordExpectations recorder = RecorderManager.StartRecording())
{
Process mockProcess = new Process();
recorder.ExpectAndReturn(mockProcess.StartInfo.FileName, "test");
}
Process proc = new Process();
Assert.AreEqual(proc.StartInfo.FileName, "test");
MockManager.Verify();
}
Hope it helps. Please tell me if you have more questions.