Пример #1
0
        public async Task GetEvents()
        {
            var queueRepository = new QueueRepository(_hangfireContext);

            var eventAndJob  = new EventAndJob(new UserUpdateNameEvent("Dude", Guid.NewGuid()), "Job");
            var eventAndJob2 = new EventAndJob(new UserUpdateNameEvent("Dude", Guid.NewGuid()), "JobSecond");
            await queueRepository.AddEventForJob(eventAndJob);

            await queueRepository.AddEventForJob(eventAndJob2);

            var events = await queueRepository.GetEvents("Job");

            Assert.AreEqual(1, events.Count);
            Assert.AreEqual(eventAndJob, events[0]);
        }
Пример #2
0
        public async Task RemoveEvents()
        {
            var queueRepository = new QueueRepository(_hangfireContext);

            var eventAndJob = new EventAndJob(new UserUpdateNameEvent("Dude", Guid.NewGuid()), "Job");
            await queueRepository.AddEventForJob(eventAndJob);

            await queueRepository.RemoveEventsFromQueue(new List <EventAndJob> {
                eventAndJob
            });

            var events = await queueRepository.GetEvents("Job");

            Assert.AreEqual(0, events.Count);
        }