コード例 #1
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ReturnsCachedDevices()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            DiscoveredSsdpDevice device = null;
            bool newlyDiscovered        = false;
            var  receivedNotification   = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device               = args.DiscoveredDevice;
                    newlyDiscovered      = args.IsNewlyDiscovered;
                    receivedNotification = true;
                    eventSignal.Set();
                };
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockAliveNotification());
                eventSignal.WaitOne(10000);
                Assert.IsTrue(receivedNotification);

                var results = deviceLocator.SearchAsync(TimeSpan.Zero).GetAwaiter().GetResult();
                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.IsTrue(results.First().Usn == device.Usn);
            }
        }
コード例 #2
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_DoesNotRaiseDeviceAvailableIfDisposed()
        {
            var server                  = new MockCommsServer();
            var deviceLocator           = new MockDeviceLocator(server);
            DiscoveredSsdpDevice device = null;
            bool newlyDiscovered        = false;

            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device               = args.DiscoveredDevice;
                    newlyDiscovered      = args.IsNewlyDiscovered;
                    receivedNotification = true;
                };
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockAliveNotification());
                server.Dispose();
                eventSignal.WaitOne(1000);
            }

            Assert.IsFalse(receivedNotification);
        }
コード例 #3
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_SearchResponseDefaultsToZeroMaxAge()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice = CreateDeviceTree();

            publishedDevice.CacheLifetime = TimeSpan.FromMinutes(30);

            DiscoveredSsdpDevice device = null;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    eventSignal.Set();
                };

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(3));
                System.Threading.Thread.Sleep(500);
                server.MockReceiveMessage(GetMockSearchResponseWithCustomCacheHeader(publishedDevice, publishedDevice.Udn, String.Format("CACHE-CONTROL: public")));
                eventSignal.WaitOne(10000);
                var results = t.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.AreEqual(TimeSpan.Zero, results.First().CacheLifetime);
            }
        }
コード例 #4
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_SearchResponseMissingCacheHeaderIsNonCacheable()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice         = CreateDeviceTree();
            DiscoveredSsdpDevice device = null;
            var receivedNotification    = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    receivedNotification = true;
                    eventSignal.Set();
                };

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(3));
                System.Threading.Thread.Sleep(500);
                server.MockReceiveMessage(GetMockSearchResponseWithCustomCacheHeader(publishedDevice, publishedDevice.Udn, null));
                eventSignal.WaitOne(10000);
                var results = t.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.IsTrue(receivedNotification);
                Assert.IsNotNull(device);
                Assert.AreEqual(device.Usn, String.Format("{0}:{1}", publishedDevice.Udn, publishedDevice.FullDeviceType));
                Assert.AreEqual(device.NotificationType, publishedDevice.Udn);
            }
        }
コード例 #5
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_DoesNotRaiseDeviceUnavailableWithUnmatchedNotificationFilter()
        {
            var publishedDevice = CreateDeviceTree();

            var server            = new MockCommsServer();
            var deviceLocator     = new MockDeviceLocator(server);
            var discoveredDevices = new List <DiscoveredSsdpDevice>();

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceUnavailable += (sender, args) =>
                {
                    discoveredDevices.Add(args.DiscoveredDevice);
                    eventSignal.Set();
                };
                deviceLocator.NotificationFilter = "uuid:" + Guid.NewGuid().ToString();
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockByeByeNotification(publishedDevice));
                eventSignal.WaitOne(1000);
                server.MockReceiveBroadcast(GetMockByeByeNotification(publishedDevice.Devices.First().Devices.First()));
                eventSignal.WaitOne(1000);
                server.MockReceiveBroadcast(GetMockByeByeNotification(publishedDevice.Devices.First()));
                eventSignal.WaitOne(1000);
            }

            Assert.IsFalse(discoveredDevices.Any());
        }
コード例 #6
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_RaisesDeviceAvailableOnResponse()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice         = CreateDeviceTree();
            DiscoveredSsdpDevice device = null;
            bool newlyDiscovered        = false;
            var  receivedNotification   = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device               = args.DiscoveredDevice;
                    newlyDiscovered      = args.IsNewlyDiscovered;
                    receivedNotification = true;
                    eventSignal.Set();
                };


                var task = deviceLocator.SearchAsync(TimeSpan.FromSeconds(2));
                server.MockReceiveMessage(GetMockSearchResponse(publishedDevice, publishedDevice.Udn));
                eventSignal.WaitOne(10000);
                Assert.IsTrue(receivedNotification);
                var results = task.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.IsTrue(results.First().Usn == device.Usn);
            }
        }
コード例 #7
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_ReceivesByeByeNotificationsForKnownDevice()
        {
            var server                  = new MockCommsServer();
            var deviceLocator           = new MockDeviceLocator(server);
            var receivedNotification    = false;
            DiscoveredSsdpDevice device = null;
            bool expired                = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceUnavailable += (sender, args) =>
                {
                    device  = args.DiscoveredDevice;
                    expired = args.Expired;
                    receivedNotification = true;
                    eventSignal.Set();
                };
                deviceLocator.StartListeningForNotifications();
                server.MockReceiveBroadcast(GetMockAliveNotification());
                server.WaitForMessageToProcess(10000);

                server.MockReceiveBroadcast(GetMockByeByeNotification());
                eventSignal.WaitOne(10000);
            }

            Assert.IsTrue(receivedNotification);
            Assert.IsNotNull(device);
            Assert.IsFalse(expired);
        }
コード例 #8
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_RaisesDeviceUnavailableWithMatchedNotificationFilter()
        {
            var publishedDevice = CreateDeviceTree();

            var server            = new MockCommsServer();
            var deviceLocator     = new MockDeviceLocator(server);
            var discoveredDevices = new List <DiscoveredSsdpDevice>();

            using (var eventSignal = new System.Threading.ManualResetEvent(false))
            {
                deviceLocator.DeviceUnavailable += (sender, args) =>
                {
                    discoveredDevices.Add(args.DiscoveredDevice);
                    eventSignal.Set();
                };
                deviceLocator.NotificationFilter = publishedDevice.Devices.First().Udn;
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockByeByeNotification(publishedDevice));
                server.WaitForMessageToProcess(10000);
                server.MockReceiveBroadcast(GetMockByeByeNotification(publishedDevice.Devices.First().Devices.First()));
                server.WaitForMessageToProcess(10000);
                server.MockReceiveBroadcast(GetMockByeByeNotification(publishedDevice.Devices.First()));
                server.WaitForMessageToProcess(10000);
                eventSignal.WaitOne(10000);
            }

            Assert.IsTrue(discoveredDevices.Any());
            Assert.IsFalse(discoveredDevices.Any((d) => { return(!d.Usn.StartsWith(publishedDevice.Devices.First().Udn)); }));
        }
コード例 #9
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_DoesNotRaiseDeviceAvailableIfDisposed()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);
            DiscoveredSsdpDevice device = null;
            bool newlyDiscovered = false;

            var receivedNotification = false;
            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    newlyDiscovered = args.IsNewlyDiscovered;
                    receivedNotification = true;
                };
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockAliveNotification());
                server.Dispose();
                eventSignal.WaitOne(1000);
            }

            Assert.IsFalse(receivedNotification);
        }
コード例 #10
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_HandlesByeByeDuringSearch()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            DiscoveredSsdpDevice device = null;
            var receivedNotification    = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceUnavailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    receivedNotification = true;
                    eventSignal.Set();
                };
                deviceLocator.StartListeningForNotifications();
                server.MockReceiveBroadcast(GetMockAliveNotification());
                server.WaitForMessageToProcess(10000);

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(3));
                System.Threading.Thread.Sleep(500);
                server.MockReceiveBroadcast(GetMockByeByeNotification());
                eventSignal.WaitOne(10000);
                var results = t.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsFalse(results.Any());
            }

            Assert.IsTrue(receivedNotification);
            Assert.IsNotNull(device);
        }
コード例 #11
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_StartListeningThrowsIfDisposed()
        {
            var deviceLocator = new MockDeviceLocator();

            deviceLocator.Dispose();

            deviceLocator.StartListeningForNotifications();
        }
コード例 #12
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_IsSearching_ReturnsTrueWhenSearchInProgress()
        {
            var deviceLocator = new MockDeviceLocator();
            Assert.IsFalse(deviceLocator.IsSearching);
            var task = deviceLocator.SearchAsync(TimeSpan.FromSeconds(1.5));
            Assert.IsTrue(deviceLocator.IsSearching);

            task.Wait();
        }
コード例 #13
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ThrowsIfSearchTimeNegative()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var searchTime = TimeSpan.FromSeconds(-5);
            var t          = deviceLocator.SearchAsync(searchTime);

            t.GetAwaiter().GetResult();
        }
コード例 #14
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ThrowsIfSearchTimeLessThan1Second()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var searchTime = TimeSpan.FromMilliseconds(500);
            var t          = deviceLocator.SearchAsync(searchTime);

            t.GetAwaiter().GetResult();
        }
コード例 #15
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ThrowsIfSearchTargetEmpty()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            string searchTarget = String.Empty;
            var    t            = deviceLocator.SearchAsync(searchTarget);

            t.GetAwaiter().GetResult();
        }
コード例 #16
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_IsSearching_ReturnsTrueWhenSearchInProgress()
        {
            var deviceLocator = new MockDeviceLocator();

            Assert.IsFalse(deviceLocator.IsSearching);
            var task = deviceLocator.SearchAsync(TimeSpan.FromSeconds(1.5));

            Assert.IsTrue(deviceLocator.IsSearching);

            task.Wait();
        }
コード例 #17
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ThrowsOnDuplicateConcurrentSearch()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            string searchTarget = "ssdp:all";
            var    t            = deviceLocator.SearchAsync(searchTarget, TimeSpan.FromSeconds(10));
            var    t2           = deviceLocator.SearchAsync(searchTarget, TimeSpan.FromSeconds(1.5));

            t2.GetAwaiter().GetResult();
        }
コード例 #18
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_AllowsZeroSearchTime()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            string searchTarget = "ssdp:all";
            var    t            = deviceLocator.SearchAsync(searchTarget, TimeSpan.Zero);

            t.GetAwaiter().GetResult();
            server.Dispose();
            deviceLocator.Dispose();
        }
コード例 #19
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_SearchesForAllDevices()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var t = deviceLocator.SearchAsync();

            t.Wait();

            Assert.IsTrue(server.SentBroadcasts.Any());
            var searchRequestData = server.SentBroadcasts.First();

            var parser        = new HttpRequestParser();
            var searchRequest = parser.Parse(System.Text.UTF8Encoding.UTF8.GetString(searchRequestData.Buffer));

            Assert.AreEqual("ssdp:all", GetFirstHeaderValue(searchRequest, "ST"));
            Assert.AreEqual("3", GetFirstHeaderValue(searchRequest, "MX"));
        }
コード例 #20
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_SearchesForSpecifiedTarget()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var searchTarget = "uuid:" + Guid.NewGuid().ToString();
            var t            = deviceLocator.SearchAsync(searchTarget);

            t.Wait();

            Assert.IsTrue(server.SentBroadcasts.Any());
            var searchRequestData = server.SentBroadcasts.First();

            var parser        = new HttpRequestParser();
            var searchRequest = parser.Parse(System.Text.UTF8Encoding.UTF8.GetString(searchRequestData.Buffer));

            Assert.AreEqual(searchTarget, GetFirstHeaderValue(searchRequest, "ST"));
            Assert.AreEqual("3", GetFirstHeaderValue(searchRequest, "MX"));
        }
コード例 #21
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_UsesSpecifiedSearchTimeLess1Second()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var searchTime = TimeSpan.FromSeconds(2);
            var t          = deviceLocator.SearchAsync(searchTime);

            t.Wait();

            Assert.IsTrue(server.SentBroadcasts.Any());
            var searchRequestData = server.SentBroadcasts.First();

            var parser        = new HttpRequestParser();
            var searchRequest = parser.Parse(System.Text.UTF8Encoding.UTF8.GetString(searchRequestData.Buffer));

            Assert.AreEqual("ssdp:all", GetFirstHeaderValue(searchRequest, "ST"));
            Assert.AreEqual((searchTime.TotalSeconds - 1).ToString(), GetFirstHeaderValue(searchRequest, "MX"));
        }
コード例 #22
0
ファイル: DeviceLocatorTests.cs プロジェクト: jay18001/RSSDP
        public void DeviceLocator_SearchAsync_FiltersNotificationsDuringSearch()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice  = CreateDeviceTree();
            var publishedDevice2 = CreateDeviceTree();

            deviceLocator.NotificationFilter = publishedDevice.Udn;
            deviceLocator.StartListeningForNotifications();

            DiscoveredSsdpDevice device = null;
            bool newlyDiscovered        = false;
            var  receivedNotification   = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;

                    newlyDiscovered      = args.IsNewlyDiscovered;
                    receivedNotification = true;
                    eventSignal.Set();
                };


                var task = deviceLocator.SearchAsync(publishedDevice.Udn);
                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice2));
                server.WaitForMessageToProcess(5000);
                eventSignal.Reset();
                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice));
                server.WaitForMessageToProcess(5000);
                eventSignal.WaitOne(10000);
                Assert.IsTrue(receivedNotification);
                var results = task.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.AreEqual(1, results.Count());
                Assert.IsTrue(results.First().Usn == device.Usn);
            }
        }
コード例 #23
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_SubsequentNotificationsUpdatesSearchResults()
        {
            var publishedDevice = CreateDeviceTree();

            var server = new MockCommsServer();

            using (var deviceLocator = new MockDeviceLocator(server))
            {
                var discoveredDevices = new List <DiscoveredSsdpDevice>();

                using (var signal = new System.Threading.AutoResetEvent(false))
                {
                    deviceLocator.DeviceAvailable += (sender, args) =>
                    {
                        discoveredDevices.Add(args.DiscoveredDevice);
                        signal.Set();
                    };
                    deviceLocator.StartListeningForNotifications();

                    server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice));
                    signal.WaitOne(10000);

                    var updatedDevice = CreateDeviceTree();
                    updatedDevice.Uuid          = publishedDevice.Uuid;
                    updatedDevice.Location      = new Uri("http://somewhereelse:1701");
                    updatedDevice.CacheLifetime = TimeSpan.FromDays(365);
                    server.MockReceiveBroadcast(GetMockAliveNotification(updatedDevice));
                    signal.WaitOne(10000);
                }

                var first  = discoveredDevices.First();
                var second = discoveredDevices.Last();

                Assert.IsTrue(discoveredDevices.Any());
                Assert.AreNotEqual(first.DescriptionLocation, second.DescriptionLocation);
                Assert.AreNotEqual(first.CacheLifetime, second.CacheLifetime);

                Assert.AreEqual(second.CacheLifetime, TimeSpan.FromDays(365));
                Assert.AreEqual(second.DescriptionLocation, new Uri("http://somewhereelse:1701"));
            }
        }
コード例 #24
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_SubsequentNotificationsUpdatesCachedCacheTime()
        {
            var publishedDevice = CreateDeviceTree();

            var server            = new MockCommsServer();
            var deviceLocator     = new MockDeviceLocator(server);
            var discoveredDevices = new List <DiscoveredSsdpDevice>();

            using (var signal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    discoveredDevices.Add(args.DiscoveredDevice);
                    signal.Set();
                };
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice));
                signal.WaitOne(10000);

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(5));

                var updatedDevice = CreateDeviceTree();
                updatedDevice.Uuid          = publishedDevice.Uuid;
                updatedDevice.CacheLifetime = TimeSpan.FromDays(365);
                server.MockReceiveBroadcast(GetMockAliveNotification(updatedDevice));
                signal.WaitOne(10000);

                var results = t.GetAwaiter().GetResult();
                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.AreEqual(String.Format("{0}::{1}", publishedDevice.Udn, publishedDevice.FullDeviceType), discoveredDevices.Last().Usn);

                var first  = discoveredDevices.First();
                var second = discoveredDevices.Last();

                Assert.AreNotEqual(first.CacheLifetime, second.CacheLifetime);

                Assert.AreEqual(second.CacheLifetime, TimeSpan.FromDays(365));
            }
        }
コード例 #25
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_IgnoresNonNotifyRequest()
        {
            var server                  = new MockCommsServer();
            var deviceLocator           = new MockDeviceLocator(server);
            var receivedNotification    = false;
            DiscoveredSsdpDevice device = null;
            bool expired                = false;

            deviceLocator.DeviceUnavailable += (sender, args) =>
            {
                device  = args.DiscoveredDevice;
                expired = args.Expired;
                receivedNotification = true;
            };
            deviceLocator.StartListeningForNotifications();

            server.MockReceiveBroadcast(GetMockNonNotifyRequest());
            server.WaitForMessageToProcess(10000);
            server.Dispose();

            Assert.IsFalse(receivedNotification);
        }
コード例 #26
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_StopListeningNoLongerReceivesNotifications()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            deviceLocator.StartListeningForNotifications();
            deviceLocator.StopListeningForNotifications();

            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    receivedNotification = true;
                    eventSignal.Set();
                };

                server.MockReceiveBroadcast(GetMockAliveNotification());
                eventSignal.WaitOne(1000);
            }

            Assert.IsFalse(receivedNotification);
        }
コード例 #27
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_AllowsZeroSearchTime()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            string searchTarget = "ssdp:all";
            var t = deviceLocator.SearchAsync(searchTarget, TimeSpan.Zero);
            t.GetAwaiter().GetResult();
            server.Dispose();
            deviceLocator.Dispose();
        }
コード例 #28
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_FiltersNotificationsDuringSearch()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice = CreateDeviceTree();
            var publishedDevice2 = CreateDeviceTree();

            deviceLocator.NotificationFilter = publishedDevice.Udn;
            deviceLocator.StartListeningForNotifications();

            DiscoveredSsdpDevice device = null;
            bool newlyDiscovered = false;
            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    newlyDiscovered = args.IsNewlyDiscovered;
                    receivedNotification = true;
                    eventSignal.Set();
                };

                var task = deviceLocator.SearchAsync(publishedDevice.Udn);
                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice2));
                server.WaitForMessageToProcess(5000);
                eventSignal.Reset();
                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice));
                server.WaitForMessageToProcess(5000);
                eventSignal.WaitOne(10000);
                Assert.IsTrue(receivedNotification);
                var results = task.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.AreEqual(1, results.Count());
                Assert.IsTrue(results.First().Usn == device.Usn);
            }
        }
コード例 #29
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_SubsequentNotificationsUpdatesCachedDescriptionLocation()
        {
            var publishedDevice = CreateDeviceTree();

            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);
            var discoveredDevices = new List<DiscoveredSsdpDevice>();

            using (var signal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    discoveredDevices.Add(args.DiscoveredDevice);
                    signal.Set();
                };
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice));
                signal.WaitOne(10000);

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(5));

                var updatedDevice = CreateDeviceTree();
                updatedDevice.Uuid = publishedDevice.Uuid;
                updatedDevice.Location = new Uri("http://somewhereelse:1701");
                server.MockReceiveBroadcast(GetMockAliveNotification(updatedDevice));
                signal.WaitOne(10000);

                var results = t.GetAwaiter().GetResult();
                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.AreEqual(String.Format("{0}::{1}", publishedDevice.Udn, publishedDevice.FullDeviceType), discoveredDevices.Last().Usn);

                var first = discoveredDevices.First();
                var second = discoveredDevices.Last();

                Assert.AreNotEqual(first.DescriptionLocation, second.DescriptionLocation);

                Assert.AreEqual(second.DescriptionLocation, new Uri("http://somewhereelse:1701"));
            }
        }
コード例 #30
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_SubsequentNotificationsUpdatesSearchResults()
        {
            var publishedDevice = CreateDeviceTree();

            var server = new MockCommsServer();
            using (var deviceLocator = new MockDeviceLocator(server))
            {
                var discoveredDevices = new List<DiscoveredSsdpDevice>();

                using (var signal = new System.Threading.AutoResetEvent(false))
                {
                    deviceLocator.DeviceAvailable += (sender, args) =>
                    {
                        discoveredDevices.Add(args.DiscoveredDevice);
                        signal.Set();
                    };
                    deviceLocator.StartListeningForNotifications();

                    server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice));
                    signal.WaitOne(10000);

                    var updatedDevice = CreateDeviceTree();
                    updatedDevice.Uuid = publishedDevice.Uuid;
                    updatedDevice.Location = new Uri("http://somewhereelse:1701");
                    updatedDevice.CacheLifetime = TimeSpan.FromDays(365);
                    server.MockReceiveBroadcast(GetMockAliveNotification(updatedDevice));
                    signal.WaitOne(10000);
                }

                var first = discoveredDevices.First();
                var second = discoveredDevices.Last();

                Assert.IsTrue(discoveredDevices.Any());
                Assert.AreNotEqual(first.DescriptionLocation, second.DescriptionLocation);
                Assert.AreNotEqual(first.CacheLifetime, second.CacheLifetime);

                Assert.AreEqual(second.CacheLifetime, TimeSpan.FromDays(365));
                Assert.AreEqual(second.DescriptionLocation, new Uri("http://somewhereelse:1701"));
            }
        }
コード例 #31
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ThrowsOnDuplicateConcurrentSearch()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            string searchTarget = "ssdp:all";
            var t = deviceLocator.SearchAsync(searchTarget, TimeSpan.FromSeconds(10));
            var t2 = deviceLocator.SearchAsync(searchTarget, TimeSpan.FromSeconds(1.5));
            t2.GetAwaiter().GetResult();
        }
コード例 #32
0
ファイル: DeviceLocatorTests.cs プロジェクト: sk8tz/RSSDP
        public void DeviceLocator_Notifications_RetrievesCustomHeader()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice = CreateDeviceTree(new CustomHttpHeader("machinename", Environment.MachineName));
            DiscoveredSsdpDevice device = null;
            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    receivedNotification = true;
                    eventSignal.Set();
                };

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(3));
                System.Threading.Thread.Sleep(500);
                server.MockReceiveMessage(GetMockSearchResponse(publishedDevice, publishedDevice.Udn));
                eventSignal.WaitOne(10000);
                var results = t.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.IsTrue(receivedNotification);
                Assert.IsNotNull(device);

                foreach (var h1 in results.First().ResponseHeaders)
                {
                    System.Diagnostics.Debug.WriteLine(h1.Key);
                }
                Assert.AreEqual(Environment.MachineName, (from h in results.First().ResponseHeaders where h.Key == "machinename" select h.Value.FirstOrDefault()).FirstOrDefault());
                Assert.AreEqual(device.Usn, String.Format("{0}:{1}", publishedDevice.Udn, publishedDevice.FullDeviceType));
                Assert.AreEqual(device.NotificationType, publishedDevice.Udn);
            }
        }
コード例 #33
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_SearchesForSpecifiedTarget()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var searchTarget = "uuid:" + Guid.NewGuid().ToString();
            var t = deviceLocator.SearchAsync(searchTarget);
            t.Wait();

            Assert.IsTrue(server.SentBroadcasts.Any());
            var searchRequestData = server.SentBroadcasts.First();

            var parser = new HttpRequestParser();
            var searchRequest = parser.Parse(System.Text.UTF8Encoding.UTF8.GetString(searchRequestData.Buffer));

            Assert.AreEqual(searchTarget, GetFirstHeaderValue(searchRequest, "ST"));
            Assert.AreEqual("3", GetFirstHeaderValue(searchRequest, "MX"));
        }
コード例 #34
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ThrowsIfSearchTimeLessThan1Second()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var searchTime = TimeSpan.FromMilliseconds(500);
            var t = deviceLocator.SearchAsync(searchTime);
            t.GetAwaiter().GetResult();
        }
コード例 #35
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_RaisesDeviceAvailableOnResponse()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice = CreateDeviceTree();
            DiscoveredSsdpDevice device = null;
            bool newlyDiscovered = false;
            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    newlyDiscovered = args.IsNewlyDiscovered;
                    receivedNotification = true;
                    eventSignal.Set();
                };

                var task = deviceLocator.SearchAsync(TimeSpan.FromSeconds(2));
                server.MockReceiveMessage(GetMockSearchResponse(publishedDevice, publishedDevice.Udn));
                eventSignal.WaitOne(10000);
                Assert.IsTrue(receivedNotification);
                var results = task.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.IsTrue(results.First().Usn == device.Usn);
            }
        }
コード例 #36
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_DoesNotRaiseDeviceAvailableWithUnmatchedNotificationFilter()
        {
            var publishedDevice = CreateDeviceTree();

            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);
            var discoveredDevices = new List<DiscoveredSsdpDevice>();

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    discoveredDevices.Add(args.DiscoveredDevice);
                    eventSignal.Set();
                };
                deviceLocator.NotificationFilter = publishedDevice.Devices.First().Udn;
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice));
                eventSignal.WaitOne(1000);
                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice.Devices.First()));
                eventSignal.WaitOne(1000);
                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice.Devices.First().Devices.First()));
                eventSignal.WaitOne(1000);
            }

            Assert.IsTrue(discoveredDevices.Any());
            Assert.IsFalse(discoveredDevices.Any((d) => { return !d.Usn.StartsWith(publishedDevice.Devices.First().Udn); }));
        }
コード例 #37
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_ReceivesByeByeNotificationsForUnknownDevice()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);
            var receivedNotification = false;
            DiscoveredSsdpDevice device = null;
            bool expired = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceUnavailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    expired = args.Expired;
                    receivedNotification = true;
                    eventSignal.Set();
                };
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockByeByeNotification());
                eventSignal.WaitOne(10000);
            }

            Assert.IsTrue(receivedNotification);
            Assert.IsNotNull(device);
            Assert.IsFalse(expired);
        }
コード例 #38
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_RaisesDeviceAvailableWithMatchedNotificationFilter()
        {
            var publishedDevice = CreateDeviceTree();

            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);
            var discoveredDevices = new List<DiscoveredSsdpDevice>();

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    discoveredDevices.Add(args.DiscoveredDevice);
                    eventSignal.Set();
                };
                deviceLocator.NotificationFilter = "uuid: " + System.Guid.NewGuid().ToString();
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice));
                eventSignal.WaitOne(1000);
                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice.Devices.First()));
                eventSignal.WaitOne(1000);
                server.MockReceiveBroadcast(GetMockAliveNotification(publishedDevice.Devices.First().Devices.First()));
                eventSignal.WaitOne(1000);
            }

            Assert.IsFalse(discoveredDevices.Any());
        }
コード例 #39
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
 public void DeviceLocator_Constructor_ThrowsOnNullCommsServer()
 {
     var deviceLocator = new MockDeviceLocator(null);
 }
コード例 #40
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_IgnoresNonNotifyRequest()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);
            var receivedNotification = false;
            DiscoveredSsdpDevice device = null;
            bool expired = false;

            deviceLocator.DeviceUnavailable += (sender, args) =>
            {
                device = args.DiscoveredDevice;
                expired = args.Expired;
                receivedNotification = true;
            };
            deviceLocator.StartListeningForNotifications();

            server.MockReceiveBroadcast(GetMockNonNotifyRequest());
            server.WaitForMessageToProcess(10000);
            server.Dispose();

            Assert.IsFalse(receivedNotification);
        }
コード例 #41
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_HandlesByeByeDuringSearch()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            DiscoveredSsdpDevice device = null;
            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceUnavailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    receivedNotification = true;
                    eventSignal.Set();
                };
                deviceLocator.StartListeningForNotifications();
                server.MockReceiveBroadcast(GetMockAliveNotification());
                server.WaitForMessageToProcess(10000);

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(3));
                System.Threading.Thread.Sleep(500);
                server.MockReceiveBroadcast(GetMockByeByeNotification());
                eventSignal.WaitOne(10000);
                var results = t.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsFalse(results.Any());
            }

            Assert.IsTrue(receivedNotification);
            Assert.IsNotNull(device);
        }
コード例 #42
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ReturnsCachedDevices()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            DiscoveredSsdpDevice device = null;
            bool newlyDiscovered = false;
            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    newlyDiscovered = args.IsNewlyDiscovered;
                    receivedNotification = true;
                    eventSignal.Set();
                };
                deviceLocator.StartListeningForNotifications();

                server.MockReceiveBroadcast(GetMockAliveNotification());
                eventSignal.WaitOne(10000);
                Assert.IsTrue(receivedNotification);

                var results = deviceLocator.SearchAsync(TimeSpan.Zero).GetAwaiter().GetResult();
                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.IsTrue(results.First().Usn == device.Usn);
            }
        }
コード例 #43
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_SearchResponseMissingCacheHeaderIsNonCacheable()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice = CreateDeviceTree();
            DiscoveredSsdpDevice device = null;
            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    receivedNotification = true;
                    eventSignal.Set();
                };

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(3));
                System.Threading.Thread.Sleep(500);
                server.MockReceiveMessage(GetMockSearchResponseWithCustomCacheHeader(publishedDevice, publishedDevice.Udn, null));
                eventSignal.WaitOne(10000);
                var results = t.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.IsTrue(receivedNotification);
                Assert.IsNotNull(device);
                Assert.AreEqual(device.Usn, String.Format("{0}:{1}", publishedDevice.Udn, publishedDevice.FullDeviceType));
                Assert.AreEqual(device.NotificationType, publishedDevice.Udn);
            }
        }
コード例 #44
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_SearchesForAllDevices()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var t = deviceLocator.SearchAsync();
            t.Wait();

            Assert.IsTrue(server.SentBroadcasts.Any());
            var searchRequestData = server.SentBroadcasts.First();

            var parser = new HttpRequestParser();
            var searchRequest = parser.Parse(System.Text.UTF8Encoding.UTF8.GetString(searchRequestData.Buffer));

            Assert.AreEqual("ssdp:all", GetFirstHeaderValue(searchRequest, "ST"));
            Assert.AreEqual("3", GetFirstHeaderValue(searchRequest, "MX"));
        }
コード例 #45
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_SearchResponseUsesSharedMaxAge()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var publishedDevice = CreateDeviceTree();
            publishedDevice.CacheLifetime = TimeSpan.FromMinutes(30);

            DiscoveredSsdpDevice device = null;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    device = args.DiscoveredDevice;
                    eventSignal.Set();
                };

                var t = deviceLocator.SearchAsync(TimeSpan.FromSeconds(3));
                System.Threading.Thread.Sleep(500);
                server.MockReceiveMessage(GetMockSearchResponseWithCustomCacheHeader(publishedDevice, publishedDevice.Udn, String.Format("CACHE-CONTROL: public, s-maxage={0}", publishedDevice.CacheLifetime.TotalSeconds)));
                eventSignal.WaitOne(10000);
                var results = t.GetAwaiter().GetResult();

                Assert.IsNotNull(results);
                Assert.IsTrue(results.Any());
                Assert.AreEqual(device.CacheLifetime, results.First().CacheLifetime);
            }
        }
コード例 #46
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ThrowsIfSearchTargetNull()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            string searchTarget = null;
            var t = deviceLocator.SearchAsync(searchTarget);
            t.GetAwaiter().GetResult();
        }
コード例 #47
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_StartListeningThrowsIfDisposed()
        {
            var deviceLocator = new MockDeviceLocator();
            deviceLocator.Dispose();

            deviceLocator.StartListeningForNotifications();
        }
コード例 #48
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_ThrowsIfSearchTimeNegative()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var searchTime = TimeSpan.FromSeconds(-5);
            var t = deviceLocator.SearchAsync(searchTime);
            t.GetAwaiter().GetResult();
        }
コード例 #49
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_StopListeningNoLongerReceivesNotifications()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);
            deviceLocator.StartListeningForNotifications();
            deviceLocator.StopListeningForNotifications();

            var receivedNotification = false;
            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    receivedNotification = true;
                    eventSignal.Set();
                };

                server.MockReceiveBroadcast(GetMockAliveNotification());
                eventSignal.WaitOne(1000);
            }

            Assert.IsFalse(receivedNotification);
        }
コード例 #50
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_SearchAsync_UsesSpecifiedSearchTimeLess1Second()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            var searchTime = TimeSpan.FromSeconds(2);
            var t = deviceLocator.SearchAsync(searchTime);
            t.Wait();

            Assert.IsTrue(server.SentBroadcasts.Any());
            var searchRequestData = server.SentBroadcasts.First();

            var parser = new HttpRequestParser();
            var searchRequest = parser.Parse(System.Text.UTF8Encoding.UTF8.GetString(searchRequestData.Buffer));

            Assert.AreEqual("ssdp:all", GetFirstHeaderValue(searchRequest, "ST"));
            Assert.AreEqual((searchTime.TotalSeconds - 1).ToString(), GetFirstHeaderValue(searchRequest, "MX"));
        }
コード例 #51
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
 public void DeviceLocator_Constructor_ThrowsOnNullCommsServer()
 {
     var deviceLocator = new MockDeviceLocator(null);
 }