public void TestCreateDisposeClient(IIpcProvider provider) { var m1 = provider.CreateNewConnectionString(); using (provider.GetClient(m1, new ClientConfig())) { } }
public void TestCreateDisposeServer(IIpcProvider provider) { var m1 = provider.CreateNewConnectionString(); using (var server = provider.GetServer(m1, new ServerConfig())) { } }
public void TestServerConsideredNotCompletedBeforeStarted(IIpcProvider provider) { var m1 = provider.CreateNewConnectionString(); using (var server = provider.GetServer(m1, new ServerConfig())) { Assert.False(server.Completion.IsCompleted); } }
public void TestCreateStartStopDisposeServer(IIpcProvider provider) { var m1 = provider.CreateNewConnectionString(); using (var server = provider.GetServer(m1, new ServerConfig())) { server.Start(EchoingExecutor); Assert.False(server.Completion.IsCompleted); server.RequestStop(); WaitServerDone(server); } }
public void TestServerMultipleDispose(IIpcProvider provider) { var m1 = provider.CreateNewConnectionString(); using (var server = provider.GetServer(m1, new ServerConfig())) { server.Start(EchoingExecutor); server.RequestStop(); WaitServerDone(server); server.Dispose(); } }
public void TestServerMultipleStartFails(IIpcProvider provider) { var testName = nameof(TestServerMultipleStartFails); var m1 = provider.CreateNewConnectionString(); using (var server = provider.GetServer(m1, ServerConfigWithLogger(testName))) { server.Start(EchoingExecutor); var ex = Assert.Throws <IpcException>(() => server.Start(EchoingExecutor)); Assert.Equal(IpcException.IpcExceptionKind.MultiStart, ex.Kind); server.RequestStop(); WaitServerDone(server); } }
public async Task TestWithConnectionErrorAsync(IIpcProvider provider) { var testName = nameof(TestWithConnectionErrorAsync); var connectionString = provider.CreateNewConnectionString(); var config = new ClientConfig() { Logger = VerboseLogger(testName), MaxConnectRetries = 2, ConnectRetryDelay = TimeSpan.FromMilliseconds(1) }; using var client = provider.GetClient(connectionString, config); var syncOpResult = await client.Send(new IpcOperation("sync hi", waitForServerAck : true)); var asyncOpResult = await client.Send(new IpcOperation("async hi", waitForServerAck : false)); // operations should fail because no server was started XAssert.AreEqual(IpcResultStatus.ConnectionError, syncOpResult.ExitCode); XAssert.AreEqual(IpcResultStatus.ConnectionError, asyncOpResult.ExitCode); XAssert.IsFalse(syncOpResult.Succeeded); XAssert.IsFalse(asyncOpResult.Succeeded); }
private string GetOrAddConnectionString(string monikerId) { return(m_moniker2connectionString.GetOrAdd(monikerId, (mId) => m_provider.CreateNewConnectionString())); }
private static Client CreateDummyBxlApiClient(IIpcProvider ipcProvider) { return(new Client(new MockClient(ipcProvider.GetClient(ipcProvider.CreateNewConnectionString(), new ClientConfig())))); }