Interesting case.
I changed the tested code to reflect your problem
public ConstructorTest(string message)
{
MyMessage = WriteMessage(message);
}
private string WriteMessage(string message)
{
if (String.IsNullOrEmpty(message))
throw new ArgumentNullException();
return message + " bye.";
}
Here is how to do it with ReflectiveMocks
var a = MockManager.Mock<ConstructorTest>(Constructor.NotMocked);
a.AlwaysReturn("WriteMessage", "faked");
var fake = new ConstructorTest ("");
Now this will pass
Assert.AreEqual("faked", fake.MyMessage);
Here is a way to do it with an AAA hack.
var fake = Isolate.Fake.Instance<UT>(Members.CallOriginal,ConstructorWillBe.Ignored);
Isolate.NonPublic.WhenCalled(fake ,"WriteMessage").WillReturn("faked");
// call the constructor hack, make sure it is not mocked
MockManager.GetMockOf(fake).ExpectUnmockedConstructor();
// call constructor via reflection
typeof(UT).GetConstructor(new Type[] {typeof(string)}).Invoke(fake,new object[]{""});
Or you can swap the next instance as follows
var tempFake = Isolate.Fake.Instance<UT>(Members.CallOriginal,ConstructorWillBe.Ignored);
Isolate.NonPublic.WhenCalled(tempFake,"WriteMessage").WillReturn("faked");
// make sure the constructor is called for the next instance hack
MockManager.GetMockOf(tempFake).ExpectUnmockedConstructor();
Isolate.Swap.NextInstance<UT>().With(tempFake);
var fake = new UT("");