Try the following production code:
public class Log4NetTest
{
public void TestRun()
{
log4net.Config.XmlConfigurator.Configure();
var log = LogManager.GetLogger(typeof(Log4NetTest));
log.Error("Worse");
log.Info("Dont Kid");
}
}
public class Log4NetTypeMock
{
public static readonly ILog log
= LogManager.GetLogger(typeof(Log4NetTypeMock))
;
public static readonly Log4NetTest log4Net;
}
And the test3:
[Test, Isolated]
public void Test1()
{
Isolate.WhenCalled(() => Log4NetTypeMock.log)
.ReturnRecursiveFake();
Assert.AreEqual(2, 1 + 1);
}
[Test, Isolated]
public void Test3()
{
Isolate.WhenCalled(() => Log4NetTypeMock.log4Net)
.ReturnRecursiveFake();
Isolate.WhenCalled(() => Log4NetTypeMock.log)
.ReturnRecursiveFake();
Assert.AreEqual(2, 1 + 1);
}
Test1() passes, but Test3() fails. This is also a bug.
________
PORNSTARS SOLEIL