BlueCollar.Test.RepositoryTests.GetQueuedList C# (CSharp) Method

GetQueuedList() protected method

Get queued list tests.
protected GetQueuedList ( ) : void
return void
        protected void GetQueuedList()
        {
            if (this.Repository != null)
            {
                IJob job = new TestJob() { Id = Guid.NewGuid() };

                WorkerRecord workerRecord = new WorkerRecord()
                {
                    ApplicationName = BlueCollarSection.Section.ApplicationName,
                    MachineAddress = Machine.Address,
                    MachineName = Machine.Name,
                    Name = "Test Worker",
                    QueueNames = "*",
                    Signal = WorkerSignal.Stop,
                    Status = WorkerStatus.Working,
                    Startup = WorkerStartupType.Automatic,
                    UpdatedOn = DateTime.UtcNow
                };

                this.Repository.CreateWorker(workerRecord, null);

                QueueRecord queueRecord = new QueueRecord()
                {
                    ApplicationName = workerRecord.ApplicationName,
                    Data = JobSerializer.Serialize(job),
                    JobName = job.Name,
                    JobType = JobSerializer.GetTypeName(job.GetType()),
                    QueuedOn = DateTime.UtcNow,
                    QueueName = "*",
                    TryNumber = 1
                };

                this.Repository.CreateQueued(queueRecord, null);

                var list = this.Repository.GetQueuedList(workerRecord.ApplicationName, null, 100, 0, null);
                Assert.IsNotNull(list);
                Assert.AreEqual(1, list.TotalCount);
                Assert.AreEqual(1, list.Records.Count);

                list = this.Repository.GetQueuedList(workerRecord.ApplicationName, "boo", 100, 0, null);
                Assert.IsNotNull(list);
                Assert.AreEqual(0, list.TotalCount);
                Assert.AreEqual(0, list.Records.Count);
            }
        }