Hi everyone,
I'm trying to use Reflective Mocks to test some code.
public class Class1
{
private Thread _thread;
private int _value;
public int GetValue()
{
_thread.Join();
this.PerformComplexManipulationsOfValue(); // private method
return _value;
}
}
Where some other code spins up a thread to retrieve the Value and stick it in "_value". I tried setting up the mock like this:
MockObject class1Mock = MockManager.MockObject(typeof(Class1), Constructor.Mocked, new object[0]);
// This would ideally cause _thread.Join() to simply return
MockManager.MockAll(typeof(Thread), Constructor.Mocked);
// See if the value is what we think it is
((Class1)class1Mock.Object).GetValue();
We can't mock Thread because it's in mscorlib.dll. I'd rather not use ObjectState to read the "_value" field. I would like to call GetValue() to do the work. Any idea what I could be doing?
Thanks!