public void TestGetCounter() { RedisCounterFactory.SetRCM("localhost", 6379, 0); var rc = RedisCounterFactory.GetCounter(); Assert.IsType <RedisCounter>(rc); }
public void TestInitRCM() { // Assuming redis available on localhost:6379. If fails will throw an exception try { RedisCounterFactory.SetRCM("localhost", 6379, 0); } catch (Exception e) { Assert.True(false, e.Message); } }
static Program() { // Get the Reddis Address from env var string raddr = Environment.GetEnvironmentVariable("REDIS_ADDR"); if (String.IsNullOrEmpty(raddr)) { Console.WriteLine("error: REDIS_ADDR environment variable is not set"); Environment.Exit(1); } // Check if raddr contains a port. If not use redis default string[] rhost = raddr.Split(':'); if (rhost.Length == 2) { RedisCounterFactory.SetRCM(rhost[0], Int32.Parse(rhost[1]), 0); } else { RedisCounterFactory.SetRCM(rhost[0], 6379, 0); } }