Is there a way to assert that a public constructor calls a private method? As shown below, the PrivateMethod is internal so that the code will compile. However, the assertion that PrivateMethod is called once fails because it's apparently called before the assertion is made. Is there a way around this dilemma? Secondly, I would like the PrivateMethod to be private (as the name suggests). Is this possible? THANKS!
[Fact]
void
Test() {
int
p = 3;
var m = Mock.Create<SUT>(p);
Mock.Arrange(() => m.PrivateMethod(p)).OccursOnce();
Mock.Assert(m);
}
public
class
SUT {
public
SUT(
int
p1) { PrivateMethod(p1); }
internal
void
PrivateMethod(
int
p) { }
}