Example #1
0
        public void Activityqueue()
        {
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.ProcessOrders), 10));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.ProcessOrders), 11));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.ProcessOrders), 12));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.Idle), 10));
            Assert.IsFalse(_activity.Add(new Activity(ActivityType.ProcessOrders), 10));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.Macro, "asd"), 10));

            Assert.AreEqual(ActivityType.ProcessOrders, _activity.Pop().Type);
            Assert.AreEqual(ActivityType.ProcessOrders, _activity.Pop().Type);
            Assert.AreEqual(ActivityType.ProcessOrders, _activity.Pop().Type);
            Assert.AreEqual(ActivityType.Idle, _activity.Pop().Type);
            Assert.AreEqual(ActivityType.Macro, _activity.Pop().Type);
            Assert.AreEqual(0, _activity.Count);

            _activity = new ActivityQueue(new Activity(ActivityType.Macro, "testing"));
            Assert.AreEqual("testing", _activity.Pop().Data);
            Assert.AreEqual("testing", _activity.Pop().Data);
            Assert.AreEqual(ActivityType.Macro, _activity.Pop().Type);

            Assert.IsTrue(_activity.Add(new Activity(ActivityType.ProcessOrders), 10));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.ProcessOrders), 20));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.ProcessOrders), 1000));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.ProcessOrders), 0));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.Macro, "first"), 15));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.Macro, "second"), 100));
            Assert.IsTrue(_activity.Add(new Activity(ActivityType.Idle), 100));

            Assert.AreEqual(7, _activity.Count);

            Assert.AreEqual(ActivityType.ProcessOrders, _activity.Pop().Type);
            Assert.AreEqual("second", _activity.Pop().Data);
            Assert.AreEqual(ActivityType.Idle, _activity.Pop().Type);
            Assert.AreEqual(ActivityType.ProcessOrders, _activity.Pop().Type);
            Assert.AreEqual("first", _activity.Pop().Data);
            Assert.AreEqual(ActivityType.ProcessOrders, _activity.Pop().Type);
            Assert.AreEqual(ActivityType.ProcessOrders, _activity.Pop().Type);
            Assert.AreEqual(0, _activity.Count);
            Assert.AreEqual("testing", _activity.Pop().Data);
            Assert.AreEqual("testing", _activity.Pop().Data);
            Assert.AreEqual("testing", _activity.Pop().Data);

            try
            {
                _activity.Add(new Activity(ActivityType.Idle), -5);
                Assert.Fail("Expected a ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }
Example #2
0
 public static void AddRetweeter(long statusId, long userId)
 {
     _retweetQueue.Add(statusId, userId);
 }
Example #3
0
 public static void AddFavoritor(long statusId, long userId)
 {
     _favoriteQueue.Add(statusId, userId);
 }