Exemple #1
0
        public void CommsServer_SendNullMulticastMessageThrowsException()
        {
            var socketFactory = new MockSocketFactory();
            var server        = new SsdpCommunicationsServer(socketFactory);

            UdpEndPoint destination = new UdpEndPoint()
            {
                IPAddress = "192.168.1.100", Port = 1701
            };

            server.SendMulticastMessage(null);
        }
Exemple #2
0
        public void CommsServer_SendMulticastMessageSendsToSsdpMulticastGroupOnUnicastSoket()
        {
            var socketFactory = new MockSocketFactory();
            var server        = new SsdpCommunicationsServer(socketFactory);

            string message = "Hello Everyone!";

            server.SendMulticastMessage(System.Text.UTF8Encoding.UTF8.GetBytes(message));

            Assert.IsNotNull(socketFactory.UnicastSocket);

            var mockSocket = socketFactory.UnicastSocket as MockSocket;

            Assert.AreEqual(message, System.Text.UTF8Encoding.UTF8.GetString(mockSocket.LastMessage));
            Assert.AreEqual(SsdpConstants.MulticastLocalAdminAddress, mockSocket.LastSentTo.IPAddress);
            Assert.AreEqual(SsdpConstants.MulticastPort, mockSocket.LastSentTo.Port);
        }