public void ProcessBatchFile()
        {
            NumberJobsFinished = 0;

            BackgroundService = CreateDummyBackgroundService();
            BackgroundService.ProcessBatchFile(DummyWorker.CreateDummyBatchFile(),
                                               EmptyDictionary);

            while (NumberJobsFinished != 3)
            {
                Thread.Sleep(10);
            }

            AssertNoExceptionThrown();
        }
        public void NewBatchInBetweenJobsOfPrevious()
        {
            BackgroundService = CreateDummyBackgroundService();
            BackgroundService.ProcessBatchFile(DummyWorker.CreateDummyBatchFile(),
                                               EmptyDictionary);

            Thread.Sleep(110);

            BackgroundService.ProcessBatchFile(DummyWorker.CreateDummyBatchFile(),
                                               EmptyDictionary);

            while (NumberJobsFinished < 2)
            {
                Thread.Sleep(10);
            }

            Assert_DeclineWhileBusyException_Thrown();
        }
        public void NewJobInBetweenJobsOfPrevious()
        {
            BackgroundService = CreateDummyBackgroundService();
            BackgroundService.ProcessBatchFile(DummyWorker.CreateDummyBatchFile(),
                                               EmptyDictionary);

            Thread.Sleep(110);

            BackgroundService.RequestNewJob("", new Dictionary <string, string>());

            while (NumberJobsFinished < 2)
            {
                Thread.Sleep(10);
            }

            Assert.IsTrue(NumberJobsFinished == 2);

            Assert_DeclineWhileBusyException_Thrown();
        }