Beispiel #1
0
        public RemoteTerminalTracerServer(
            IRemoteApiMap remoteApiMap,
            IRemoteApiOperator remoteApiOperator)
        {
            _remoteApiMap      = remoteApiMap;
            _remoteApiOperator = remoteApiOperator;

            _remoteApiMap.RegisterCommandWithParameters("traceto",
                                                        TraceToHandler, "<ip:port>");
        }
Beispiel #2
0
        public void RegisterCommandWithParameters_WhenCommandRaised_ShouldCallHandlerWithParameters()
        {
            IEnumerable <string> acceptedParameters = Enumerable.Empty <string>();

            void ResetHandler(IEnumerable <string> parameters)
            {
                acceptedParameters = parameters;
            }

            _sut.RegisterCommandWithParameters("reset", ResetHandler);

            var result = _instructionsReceiverMock.SimulateCommandReceived(Encoding.UTF8.GetBytes("reset p:12 s:21"));

            Assert.Equal("p:12", acceptedParameters.First());
            Assert.Equal("s:21", acceptedParameters.ElementAtOrDefault(1));
        }
Beispiel #3
0
 public void RegisterCommandWithParameters(string name, Action <IEnumerable <string> > handler, string description = "")
 {
     SafeExecution.TryCatch(() => _remoteApiMap.RegisterCommandWithParameters(name, handler, description),
                            exception => _recorder.DefaultException(this, exception));
 }