public void Test_CheckReceivedCalls_CallReceived() { var command = Substitute.For <ICommand>(); var something = new SomethingThatNeedsACommand(command); something.DoSomething(); command.Received().Execute(); }
public void Setup() { // Arrange, arguably cleaner/tidier to do this in the test(s) that uses these, but I like to use my setup, plus it saves repetition which is good command = Substitute.For <ICommand>(); something = new SomethingThatNeedsACommand(command); repeater = new CommandRepeater(command, 3); calculator = Substitute.For <ICalculator>(); dictionary = Substitute.For <IDictionary <string, int> >(); watcher = new CommandWatcher(command); runner = new OnceOffCommandRunner(command); }
public void TearDown() { // break it, break it down command = null; something = null; repeater = null; calculator = null; dictionary = null; watcher = null; runner = null; }
public void TestNSubstituteForEvents() { //Arrange var command = Substitute.For <ICommand>(); var something = new SomethingThatNeedsACommand(command); //Act something.DoSomething(); //Assert command.Received().Execute(); }
public void ICommand_Execute_CheckNotReceiveCall() { //Arrange var command = Substitute.For <ICommand>(); var something = new SomethingThatNeedsACommand(command); //Act something.DonotDoAnything(); //Assert 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(); }
public void Test_CheckReceivedCalls_CallReceived() { //檢查接收到的呼叫 //Arrange var command = Substitute.For <ICommand>(); var something = new SomethingThatNeedsACommand(command); //Act something.DoSomething(); //Assert command.Received(1).Execute(); }