示例#1
0
        public void TestStartAndConnectToRedi()
        {
            var rs = new RediScraper(appConfig.UserId, appConfig.Password);

            if (rs.IsRediRunning())
            {
                Console.WriteLine("Had to kill Redi for tests");
                rs.KillRedi();
            }

            var rediStarted = rs.StartRedi();

            Assert.IsTrue(rediStarted, "Failed to start Redi");

            WaitFor(WaitingForCom, rs, 10 * 1000);
            Assert.IsFalse(rs.CanConnectViaCom(), "Redi started in 10 seconds, unlikely");

            WaitFor(WaitingForCom, rs, 120 * 1000);
            Assert.IsTrue(rs.CanConnectViaCom(), "Redi failed to start in 120 seconds");

            rs.ConnectMessageListener();
            Assert.IsTrue(rs.IsMessageListenerStarted, "Message listener failed to connect");

            rs.ConnectPositionListener();
            Assert.IsTrue(rs.IsPositionListenerStarted, "Position listener failed to connect");

            Assert.IsTrue(rs.IsConnected());

            Assert.IsTrue(rs.ExecutionCount > 0, "Failed to get executions from Message table");

            rs.DisconnectMessageListener();
            Assert.IsFalse(rs.IsConnected());

            rs.DisconnectPositionListener();
        }
示例#2
0
        public void TestRediRunning()
        {
            var rs = new RediScraper("TestId", "TestPassword");

            Assert.IsFalse(rs.IsRediRunning());
        }