I have a minor but rather annoying problem.
I am doing some tests using a PrivateObject to access various methods in a class. This all works fine. However when the method signature contains "ref" the ref keyword does not seem to have any effect.
private bool NewDeviceArrivedDeviceAtWorkcenter(ThreadStartArgs args, ref Device deviceAtStation)
{
//..SomeCode
deviceAtStation = null;
//...Method to test
}
This test is failing..
[TestMethod]
public void CheckForDeviceAtWorkcenterNoDeviceFound()
{
Initialization omitted
var device = new Device();
var result = accessor.Invoke("NewDeviceArrivedDeviceAtWorkcenter",
new []
{
typeof (ThreadStartArgs),
typeof (Device).MakeByRefType()
},
new object[]
{
threadStartArgs,
device
});
Assert.IsNull(device);
}
Question: Why is device obj in the test method not set to null?
Any help appreciated
Kind Regards Carsten