Ejemplo n.º 1
0
        public void DiscoveredDevice_IsExpired_ImmediatelyReportsTrueIfCacheLifetimeIsZero()
        {
            var discoveredDevice = new DiscoveredSsdpDevice();

            discoveredDevice.AsAt          = DateTimeOffset.Now;
            discoveredDevice.CacheLifetime = TimeSpan.Zero;

            Assert.IsTrue(discoveredDevice.IsExpired());
        }
Ejemplo n.º 2
0
        public void DiscoveredDevice_IsExpired_DoesNotImmediatelyReportTrue()
        {
            var discoveredDevice = new DiscoveredSsdpDevice();

            discoveredDevice.AsAt          = DateTimeOffset.Now;
            discoveredDevice.CacheLifetime = TimeSpan.FromSeconds(1);

            Assert.IsFalse(discoveredDevice.IsExpired());
        }
Ejemplo n.º 3
0
        public void DiscoveredDevice_IsExpired_ReportsTrueAfterCacheLifetimeExpires()
        {
            var discoveredDevice = new DiscoveredSsdpDevice();

            discoveredDevice.AsAt          = DateTimeOffset.Now;
            discoveredDevice.CacheLifetime = TimeSpan.FromMilliseconds(100);
            System.Threading.Thread.Sleep(500);

            Assert.IsTrue(discoveredDevice.IsExpired());
        }