Ejemplo n.º 1
0
        public void TasksSetupsNull()
        {
            var f     = new DequeueFactory(ConnectionString);
            var tasks = f.Tasks <object>((IEnumerable <QueueSetup <object> >)null);

            Assert.IsNotNull(tasks);

            Assert.That(() => tasks.Count(), Throws.TypeOf <ArgumentNullException>());
        }
        /// <summary>
        /// Load Tasks
        /// </summary>
        /// <param name="config">Task Configuration</param>
        /// <returns>Runnable Tasks</returns>
        public virtual IEnumerable <IRunnable> Tasks(ITaskConfiguration config)
        {
            var tasks = new List <IRunnable>();

            tasks.AddRange(this.Initialize(config));

            var factory = new DequeueFactory(config.ConnectionString);

            tasks.AddRange(factory.Tasks <ImageQueued>(new ImageDequeueSetup(config)));

            return(tasks);
        }
Ejemplo n.º 3
0
        public void TasksSimple()
        {
            var f     = new DequeueFactory(ConnectionString);
            var tasks = f.Tasks <object>("test", () => { return(null); });

            Assert.IsNotNull(tasks);
            Assert.AreEqual(2, tasks.Count());

            var t = (from n in tasks
                     where n.GetType() == typeof(InitializeStorageTask)
                     select true).FirstOrDefault();

            Assert.IsTrue(t);
        }
        public void Tasks()
        {
            var setup = new QueueSetup<object>()
            {
                Name = "test",
                Priority = QueuePriority.Low,
            };
            var f = new DequeueFactory(ConnectionString);
            var tasks = f.Tasks(setup);

            Assert.IsNotNull(tasks);
            Assert.AreEqual(2, tasks.Count());

            var t = (from n in tasks
                     where n.GetType() == typeof(InitializeStorageTask)
                     select true).FirstOrDefault();

            Assert.IsTrue(t);
        }
Ejemplo n.º 5
0
        public void Tasks()
        {
            var setup = new QueueSetup <object>()
            {
                Name     = "test",
                Priority = QueuePriority.Low,
            };
            var f     = new DequeueFactory(ConnectionString);
            var tasks = f.Tasks(setup);

            Assert.IsNotNull(tasks);
            Assert.AreEqual(2, tasks.Count());

            var t = (from n in tasks
                     where n.GetType() == typeof(InitializeStorageTask)
                     select true).FirstOrDefault();

            Assert.IsTrue(t);
        }
        public void TasksMultiple()
        {
            var random = new Random();
            var count = random.Next(1, 20);
            var setups = new List<IQueueSetup<object>>();
            for (var i = 0; i < count; i++)
            {
                var setup = new QueueSetup<object>()
                {
                    Name = "test",
                    Priority = QueuePriority.Low,
                };

                setups.Add(setup);
            }
            var f = new DequeueFactory(ConnectionString);
            var tasks = f.Tasks(setups);

            Assert.IsNotNull(tasks);
            Assert.AreEqual(count * 2, tasks.Count());
        }
Ejemplo n.º 7
0
        public void TasksMultiple()
        {
            var random = new Random();
            var count  = random.Next(1, 20);
            var setups = new List <IQueueSetup <object> >();

            for (var i = 0; i < count; i++)
            {
                var setup = new QueueSetup <object>()
                {
                    Name     = "test",
                    Priority = QueuePriority.Low,
                };

                setups.Add(setup);
            }
            var f     = new DequeueFactory(ConnectionString);
            var tasks = f.Tasks(setups);

            Assert.IsNotNull(tasks);
            Assert.AreEqual(count * 2, tasks.Count());
        }
        public void TasksSetupsNull()
        {
            var f = new DequeueFactory(ConnectionString);
            var tasks = f.Tasks<object>((IEnumerable<QueueSetup<object>>)null);

            Assert.IsNotNull(tasks);
            Assert.AreEqual(2, tasks.Count());
        }
        public void TasksSimpleProcessorNull()
        {
            var f = new DequeueFactory(ConnectionString);
            var tasks = f.Tasks<object>("test", null);

            Assert.IsNotNull(tasks);
            Assert.AreEqual(2, tasks.Count());

            var t = (from n in tasks
                     where n.GetType() == typeof(InitializeStorageTask)
                     select true).FirstOrDefault();

            Assert.IsTrue(t);
        }
Ejemplo n.º 10
0
 public void TasksSimpleQueueNameNull()
 {
     var f = new DequeueFactory(ConnectionString);
     var tasks = f.Tasks<object>(null, () => { return null; });
 }
Ejemplo n.º 11
0
        public void TasksSimpleProcessorNull()
        {
            var f = new DequeueFactory(ConnectionString);

            Assert.That(() => f.Tasks <object>("test", null), Throws.TypeOf <ArgumentNullException>());
        }
Ejemplo n.º 12
0
        public void TasksSimpleQueueNameNull()
        {
            var f = new DequeueFactory(ConnectionString);

            Assert.That(() => f.Tasks <object>(null, () => { return(null); }), Throws.TypeOf <ArgumentException>());
        }