Ejemplo n.º 1
0
        public void ContentLazilyUpdated()
        {
            Context  context             = new Context(m_logger);
            TimeSpan contentHashBumpTime = TimeSpan.FromHours(1);
            ContentTrackerUpdater contentTrackerUpdater = new ContentTrackerUpdater(hashes => { }, contentHashBumpTime);

            ContentHash hash           = ContentHash.Random();
            long        size           = 0;
            DateTime    lastAccessTime = DateTime.MaxValue; // Content hash will always be above the age limit.
            ContentHashWithSizeAndLastAccessTime contentHashInfo = new ContentHashWithSizeAndLastAccessTime(hash, size, lastAccessTime);

            var eagerUpdate = contentTrackerUpdater.ScheduleHashTouches(context, new[] { contentHashInfo });

            Assert.Empty(eagerUpdate);
        }
Ejemplo n.º 2
0
        public void ContentEagerlyUpdated()
        {
            Context  context             = new Context(m_logger);
            TimeSpan contentHashBumpTime = TimeSpan.FromHours(1);
            ContentTrackerUpdater contentTrackerUpdater = new ContentTrackerUpdater(hashes => { }, contentHashBumpTime);

            ContentHash hash           = ContentHash.Random();
            long        size           = 0;
            DateTime    lastAccessTime = DateTime.MinValue; // Content hash will always be below the age limit.
            ContentHashWithSizeAndLastAccessTime contentHashInfo = new ContentHashWithSizeAndLastAccessTime(hash, size, lastAccessTime);

            var eagerUpdate = contentTrackerUpdater.ScheduleHashTouches(context, new[] { contentHashInfo });

            Assert.NotNull(eagerUpdate);
            Assert.Equal(eagerUpdate.Count, 1);
            Assert.Equal(eagerUpdate.Single().Hash, hash);
        }