在閱讀NSubstitute教程時,我將用C#編寫的示例轉換爲VB.net以瞭解功能,但我需要您對這些(無關)語句的支持,儘管採取了所有護理噸轉換:將包括NSubstitute代碼在內的C#語句轉換爲VB.net
1.
calculator().Received().Add(1, Arg.Is(Of Integer)(function(x) new[] {-2,-5,-10}.Contains(x)))
2.
注:foo是從一個接口派生對象,具有所謂的 「的SayHello」
空隙方法foo.When(x >= x.SayHello("World")).Do(x => counter++);
3.
calculator().When(x >= x.Add(-2, -2)).Do(x => { throw new Exception(); });
注:發動機是從該接口派生對象:
public interface IEngine {
event EventHandler Idling;
event EventHandler<LowFuelWarningEventArgs> LowFuelWarning;
event Action<int> RevvedAt;
}
4.
engine.Idling += (sender, args) => wasCalled = true;
5.
engine.Idling += Raise.EventWith(new object(), new EventArgs());
6.
engine.RevvedAt += rpm => revvedAt = rpm;
有了你們的支持,我希望,我能剩下的語句轉換我自己。
預先感謝您
邁克爾
嘗試把你的類:http://converter.telerik.com/ – JMan
吉榮,感謝 - 我知道這個轉換器(和其他人),但他們無法幫助我在所有情況下。 –