コード例 #1
0
        public void PollingQueues()
        {
            ITaskProcessorConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("PollingQueues");

            Assert.AreEqual(3, configuration.PollingQueues.Count());

            ITaskProcessorPollingQueueConfiguration config = configuration.PollingQueues.First();

            Assert.AreEqual("A", config.Key);
            Assert.AreEqual(TimeSpan.FromMinutes(1), config.PollInterval);
            Assert.IsTrue(config.IsMaster);
            Assert.IsFalse(config.IsActive);
            Assert.IsFalse(config.IsConcurrent);
            Assert.AreEqual(0, config.MaxWorkers);

            config = configuration.PollingQueues.Skip(1).First();

            Assert.AreEqual("B", config.Key);
            Assert.AreEqual(TimeSpan.FromMinutes(2), config.PollInterval);
            Assert.IsFalse(config.IsMaster);
            Assert.IsTrue(config.IsActive);
            Assert.IsFalse(config.IsConcurrent);
            Assert.AreEqual(5, config.MaxWorkers);

            config = configuration.PollingQueues.Skip(2).First();

            Assert.AreEqual("C", config.Key);
            Assert.AreEqual(TimeSpan.FromMinutes(3), config.PollInterval);
            Assert.IsFalse(config.IsMaster);
            Assert.IsTrue(config.IsActive);
            Assert.IsTrue(config.IsConcurrent);
            Assert.AreEqual(10, config.MaxWorkers);
        }
コード例 #2
0
        public void PollingJobs()
        {
            ITaskProcessorConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("PollingJobs");

            Assert.AreEqual(3, configuration.PollingJobs.Count());

            IPollingJobConfiguration config = configuration.PollingJobs.First();

            Assert.AreEqual(typeof(FakePollingJob), config.ImplementationType);
            Assert.AreEqual(TimeSpan.FromMinutes(1), config.PollInterval);
            Assert.IsTrue(config.IsMaster);
            Assert.IsFalse(config.IsActive);
            Assert.IsFalse(config.IsConcurrent);

            config = configuration.PollingJobs.Skip(1).First();

            Assert.AreEqual(typeof(FakePollingJob2), config.ImplementationType);
            Assert.AreEqual(TimeSpan.FromMinutes(2), config.PollInterval);
            Assert.IsFalse(config.IsMaster);
            Assert.IsTrue(config.IsActive);
            Assert.IsFalse(config.IsConcurrent);

            config = configuration.PollingJobs.Skip(2).First();

            Assert.AreEqual(typeof(FakePollingJob3), config.ImplementationType);
            Assert.AreEqual(TimeSpan.FromMinutes(3), config.PollInterval);
            Assert.IsFalse(config.IsMaster);
            Assert.IsTrue(config.IsActive);
            Assert.IsTrue(config.IsConcurrent);
        }
コード例 #3
0
        public void ClientConfiguration()
        {
            ITaskProcessorClientConfiguration configuration = AppConfigConfigurationUnitTests.GetClientConfiguration("Client");

            Assert.IsNull(configuration.GetPollingQueueKey(typeof(FakeTask)));
            Assert.AreEqual("Demo", configuration.GetPollingQueueKey(typeof(FakePollingQueueTask)));
        }
コード例 #4
0
        public void EmptyTaskWorkerConfiguration2()
        {
            ITaskWorkersConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskWorkerConfiguration("Empty2");

            Assert.IsNotNull(configuration);

            Assert.IsNull(configuration[typeof(FakeTask)]);
        }
コード例 #5
0
        public void NegativePollingQueueMaxWorkers()
        {
            var configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("NegativePollingQueueMaxWorkers");

            if (configuration.PollingQueues.First().MaxWorkers > 0)
            {
            }
        }
コード例 #6
0
        public void GetPollingJobImplementationTypeNotDescendant2()
        {
            ITaskProcessorConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("Empty");

            if (configuration.PollingJobs[typeof(ICloneable)] == null)
            {
            }
        }
コード例 #7
0
        public void GetPollingJobNullImplementationType()
        {
            ITaskProcessorConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("Empty");

            if (configuration.PollingJobs[null] == null)
            {
            }
        }
コード例 #8
0
        public void NegativeMaxTasks1()
        {
            ITaskProcessorConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("NegativeMaxTasks1");

            if (configuration.Tasks.MaxWorkers > 0)
            {
            }
        }
コード例 #9
0
        public void GetTaskJobNullTaskType()
        {
            ITaskProcessorConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("Empty");

            if (configuration.Tasks[null] == null)
            {
            }
        }
コード例 #10
0
        public void NegativeMaxTasks2()
        {
            ITaskProcessorConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("NegativeMaxTasks2");

            if (configuration.Tasks[typeof(FakeTask)].MaxWorkers > 0)
            {
            }
        }
コード例 #11
0
        public void GetScheduledTaskInvalid()
        {
            ITaskSchedulerConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskSchedulerConfiguration("TaskScheduler");

            if (configuration.ScheduledTasks[typeof(object)] == null)
            {
            }
        }
コード例 #12
0
        public void GetScheduledTaskNull()
        {
            ITaskSchedulerConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskSchedulerConfiguration("TaskScheduler");

            if (configuration.ScheduledTasks[null] == null)
            {
            }
        }
コード例 #13
0
        public void SerializationConfiguration()
        {
            ITaskProcessorSerializationConfiguration configuration = AppConfigConfigurationUnitTests.GetSerializationtConfiguration("Serialization");

            Assert.AreEqual(typeof(EntityBinarySerializer), configuration.GetSerializerType(typeof(FakeTask)));
            Assert.AreEqual(typeof(EntityXmlSerializer), configuration.GetSerializerType(typeof(ITask)));
            Assert.AreEqual(typeof(EntityBinaryXmlSerializer), configuration.GetSerializerType(typeof(object)));

            Assert.IsNull(configuration.GetSerializerType(typeof(FakePollingQueueTask)));
        }
コード例 #14
0
        public void TaskWorker()
        {
            ITaskWorkersConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskWorkerConfiguration("TaskWorker");

            Assert.AreEqual(typeof(FakeTaskWorker), configuration[typeof(FakeTask)].WorkerType);
            Assert.AreEqual(typeof(FakeTaskWorker), configuration[typeof(FakePollingQueueTask)].WorkerType);

            Assert.IsTrue(configuration[typeof(FakeTask)].HasTaskJobSettings);
            Assert.IsFalse(configuration[typeof(FakePollingQueueTask)].HasTaskJobSettings);
        }
コード例 #15
0
        public void NoMaxTasks()
        {
            ITaskProcessorConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("NoMaxTasks");

            Assert.IsNull(configuration.Tasks.MaxWorkers);

            ITaskJobConfiguration jobConfig = configuration.Tasks[typeof(IFakeTask)];

            Assert.IsNotNull(jobConfig);

            Assert.AreEqual(typeof(IFakeTask), jobConfig.TaskType);

            Assert.IsNull(jobConfig.MaxWorkers);
        }
コード例 #16
0
        public void ClientConfigurationGetPollingQueueKeyTaskTypeNotFound()
        {
            ITaskProcessorClientConfiguration config = AppConfigConfigurationUnitTests.GetClientConfiguration("Empty");

            config.GetPollingQueueKey(typeof(FakeTask));
        }
コード例 #17
0
 public void InvalidScheduledTaskType()
 {
     AppConfigConfigurationUnitTests.GetTaskSchedulerConfiguration("InvalidScheduledTaskType");
 }
コード例 #18
0
 public void TaskSchedulerEmptyScheduledTaskType()
 {
     AppConfigConfigurationUnitTests.GetTaskSchedulerConfiguration("EmptyScheduledTaskType");
 }
コード例 #19
0
        public void TaskSchedulerWaitTrue()
        {
            ITaskSchedulerConfiguration configuration = AppConfigConfigurationUnitTests.GetTaskSchedulerConfiguration("WaitTrue");

            Assert.IsTrue(configuration.ScheduledTasks[typeof(FakeScheduledTask)].WaitForPreviousSubmittedTaskToComplete);
        }
コード例 #20
0
        public void SerializationConfigurationGetSerializerTypeNull()
        {
            ITaskProcessorSerializationConfiguration configuration = AppConfigConfigurationUnitTests.GetSerializationtConfiguration("Serialization");

            configuration.GetSerializerType(null);
        }
コード例 #21
0
 public void SerializationConfigurationDuplicateTask()
 {
     AppConfigConfigurationUnitTests.GetSerializationtConfiguration("DuplicateTask");
 }
コード例 #22
0
 public void TaskWorkerDuplicateTask()
 {
     AppConfigConfigurationUnitTests.GetTaskWorkerConfiguration("DuplicateTask");
 }
コード例 #23
0
 public void TaskWorkerInvalidWorkerType()
 {
     AppConfigConfigurationUnitTests.GetTaskWorkerConfiguration("InvalidWorkerType");
 }
コード例 #24
0
        public void ClientConfigurationGetPollingQueueKeyInvalidTaskType()
        {
            ITaskProcessorClientConfiguration config = AppConfigConfigurationUnitTests.GetClientConfiguration("Client");

            config.GetPollingQueueKey(typeof(ITimer));
        }
コード例 #25
0
 public void ClientConfigurationDuplicatePollingQueue()
 {
     AppConfigConfigurationUnitTests.GetClientConfiguration("DuplicatePollingQueue");
 }
コード例 #26
0
 public void ClientConfigurationAmbiguousTask()
 {
     AppConfigConfigurationUnitTests.GetClientConfiguration("AmbigousTask");
 }
コード例 #27
0
 public void ClientConfigurationAmbiguousTaskPollingQueue()
 {
     AppConfigConfigurationUnitTests.GetClientConfiguration("AmbigousTaskPollingQueue");
 }
コード例 #28
0
 public void TaskWorkerWorkerTypeNoParameterlessConstructor()
 {
     AppConfigConfigurationUnitTests.GetTaskWorkerConfiguration("WorkerTypeNoParameterlessConstructor");
 }
コード例 #29
0
 public void EmptyTaskType()
 {
     AppConfigConfigurationUnitTests.GetTaskProcessorConfiguration("EmptyTaskType");
 }
コード例 #30
0
        public void ClientConfigurationGetPollingQueueKeyNullTaskType()
        {
            ITaskProcessorClientConfiguration config = AppConfigConfigurationUnitTests.GetClientConfiguration("Client");

            config.GetPollingQueueKey(null);
        }