Beispiel #1
0
 public void Send_InvalidArguments_Throws()
 {
     using (var udpClient = new DerivedUdpClient())
     {
         Assert.Throws <ArgumentNullException>("dgram", () => udpClient.Send(null, 0));
         Assert.Throws <ArgumentNullException>("dgram", () => udpClient.Send(null, 0, "localhost", 0));
         Assert.Throws <ArgumentNullException>("dgram", () => udpClient.Send(null, 0, new IPEndPoint(IPAddress.Loopback, 0)));
         Assert.Throws <InvalidOperationException>(() => udpClient.Send(new byte[1], 1));
         udpClient.Active = true;
         Assert.Throws <InvalidOperationException>(() => udpClient.Send(new byte[1], 1, new IPEndPoint(IPAddress.Loopback, 0)));
     }
 }
Beispiel #2
0
 public void Ctor_CanSend()
 {
     using (var udpClient = new DerivedUdpClient())
     {
         Assert.Equal(1, udpClient.Send(new byte[1], 1, new IPEndPoint(IPAddress.Loopback, UnusedPort)));
         Assert.False(udpClient.Active);
     }
 }
Beispiel #3
0
 public void Ctor_StringInt_CanSend()
 {
     using (var udpClient = new DerivedUdpClient("localhost", UnusedPort))
     {
         Assert.Equal(1, udpClient.Send(new byte[1], 1));
         Assert.True(udpClient.Active);
     }
 }