private void DisposeInternal() { if (_server != null) { _server.Shutdown(); _server = null; } }
public static void TestCall() { IRequestServer serverMock = Mock.Of <IRequestServer>(); IRequestClient clientMock = Mock.Of <IRequestClient>(x => x.Dispatch(It.Is <CommandServiceEventArgs>(ca => ca.Verb == CommandVerb.Open)) == CommandStatus.Success); CommandService service = new CommandService(serverMock, clientMock); CommandStatus status = service.Call(CommandVerb.Open, -1, @"C:\folder\file.axx"); Assert.That(status, Is.EqualTo(CommandStatus.Success), "The call should indicate success."); }
public void SetNextInChain(IRequestServer server) { if (NextInChain == null) { NextInChain = server; } else { NextInChain.SetNextInChain(server); } }
public static void TestStart() { IRequestServer serverMock = Mock.Of <IRequestServer>(); IRequestClient clientMock = Mock.Of <IRequestClient>(); CommandService service = new CommandService(serverMock, clientMock); service.StartListening(); Assert.DoesNotThrow(() => Mock.Get(serverMock).Verify(s => s.Start())); }
public CommandService(IRequestServer server, IRequestClient client) { if (server == null) { throw new ArgumentNullException("server"); } _server = server; _client = client; _server.Request += HandleServerRequest; }
public static void TestServerReceive() { IRequestServer serverMock = Mock.Of <IRequestServer>(); IRequestClient clientMock = Mock.Of <IRequestClient>(); CommandService service = new CommandService(serverMock, clientMock); bool received = false; service.Received += (sender, e) => received = e.Verb == CommandVerb.Exit; Mock.Get(serverMock).Raise(s => s.Request += null, new RequestCommandEventArgs(new CommandServiceEventArgs(CommandVerb.Exit, -1))); Assert.That(received, Is.True, "A command should be received."); }
public TimeServer(IRequestServer s = null) : base(s) { }
public CostServer(IRequestServer s = null) : base(s) { }
public DijkstraServer(IRequestServer s = null) : base(s) { }
public AbstractServer(IRequestServer server = null) { SetNextInChain(server); }
public RequestValidator(IRequestServer s = null) : base(s) { }