为什么下面的NUnit测试失败?或者为什么事件永远不会被触发?
public interface IGo
{
event Action<bool> GoNow;
}
public abstract class Goer : IGo
{
public virtual event Action<bool> GoNow = delegate {};
}
[Test]
public void VerifyNUnitRaise()
{
var mock = new Mock<Goer> {CallBase = true};
var hit = false;
mock.Object.GoNow += b => hit = b;
mock.Raise(g => g.GoNow += null, true);
Assert.IsTrue(hit);
}