public void ExecuteCommand_WhenCalled_ShouldTrySendInstruction() { Mock.Arrange(() => _instructionSenderHolder.HasActiveSender).Returns(true); Mock.Arrange(() => _instructionSenderHolder.TrySendInstruction(Arg.IsAny <IEnumerable <byte> >())) .Returns(Task.FromResult((true, Enumerable.Empty <byte>()))); _sut.ExecuteCommand("command"); Mock.Assert(() => _instructionSenderHolder.TrySendInstruction(Arg.IsAny <IEnumerable <byte> >()), Occurs.Once()); Mock.Assert(() => _recorder.RecordError(Arg.AnyString, Arg.AnyString), Occurs.Never()); }
public void ExecuteCommand_NotConnectNorDisconnect_ShouldCallExecuteCommand() { _sut.ExecuteCommand("connect2"); Mock.Assert(() => _remoteApiOperator.ExecuteCommand("connect2"), Occurs.Once()); }
private async Task ConnectAndSend(string address) { await _remoteApiOperator.ExecuteCommand($"connect {address}"); _remoteApiOperator.ExecuteCommand("hello"); }