public void ShouldNotExecuteCommand() { //Act something.DontDoAnything(); //Assert command.DidNotReceive().Execute(); // This must be in seperate test to the Received() above, as they will interfere with each other if not and fail! command.Received(0).Execute(); // Received(0) same as DidNotReceive() - DidNotReceive() is clearer to understand for me }
public void Test_CheckReceivedCalls_CallDidNotReceived() { var command = Substitute.For <ICommand>(); var something = new SomethingThatNeedsACommand(command); something.DontDoAnything(); command.DidNotReceive().Execute(); }
public void Test_CheckReceivedCalls_CallDidNotReceived() { //檢查沒有收到的呼叫 //Arrange var command = Substitute.For <ICommand>(); var something = new SomethingThatNeedsACommand(command); //Act something.DontDoAnything(); //Assert command.DidNotReceive().Execute(); }