public override Task StartInternalAsync() { _host = new RedisHost(Token, Settings.Port, new RedisEngine(Settings.Port)); _host.Start(); return(Task.Run(() => WaitHandle.WaitAll(new WaitHandle[] { Token.WaitHandle }))); }
public void RedisHost_ProcessStartsSuccessfully() { // Create a new Redis host, and ensure the process is running. RedisHost testHost = new RedisHost(); testHost.Start(); // Process running. Assert.IsTrue(testHost.Running); // Make sure the port we've requested is actually open. bool portOpen = false; try { using (TcpClient tcpClient = new TcpClient()) { tcpClient.Connect("localhost", InstanceParams.DefaultPortNumber); portOpen = true; } } catch { } // Port can be spoken to. Assert.IsTrue(portOpen); }
public void RedisHost_ProcessTerminatesSuccessfully() { // Create a new Redis host, and ensure the process is running. RedisHost testHost = new RedisHost(); testHost.Start(); // Dispose the host, and ensure that we've finished. testHost.Dispose(); Assert.IsFalse(testHost.Running); }
public void RedisHost_ReturnsAccessorWhileRunning() { // Build the test host. RedisHost testHost = new RedisHost(); testHost.Start(); // Grab the accessor. var accessor = testHost.CreateAccessor(); Assert.IsNotNull(accessor); }
public void RedisHost_ReturnsNullAccessorWhileNotRunning() { // Build the test host. RedisHost testHost = new RedisHost(); testHost.Start(); // Kill the process. testHost.Dispose(); // Grab the accessor. var accessor = testHost.CreateAccessor(); Assert.IsNull(accessor); }