Example #1
0
        TimeSpan calcTimeSpan(Throttle t, uint id)
        {
            DateTime start = DateTime.Now;
            for(int i = 0; i < 10; i++) {
                t?.SleepTillReady(id);
            }

            return DateTime.Now - start;
        }
Example #2
0
        private void throttleTest(uint id)
        {
            TimeSpan spanWithoutThrottle = calcTimeSpan(null, id);

            Throttle throttle = new Throttle(TimeSpan.FromSeconds(1));
            TimeSpan spanWithThrottle = calcTimeSpan(throttle, id);

            Assert.IsTrue(spanWithThrottle > spanWithoutThrottle);
            Assert.IsTrue(spanWithThrottle > new TimeSpan(0, 0, 9));
        }
Example #3
0
        public IrcClient(string ip, uint port, string userName, string password)
            : base(ip, (int)port)
        {
            throttle = new Throttle(TimeSpan.FromSeconds(2));
            inputStream = new StreamReader(GetStream());
            outputStream = new StreamWriter(GetStream());

            WriteLine("PASS " + password + Environment.NewLine
                 + "NICK " + userName + Environment.NewLine
                 + "USER " + userName + " 8 * :" + userName);
        }