コード例 #1
0
 public void TestException()
 {
     var test = new IP(IPAddress.Any);
     Assert.Throws<ArgumentNullException>(() => test.AppendBytesTo(null));
     Assert.Throws<ArgumentNullException>(() => new IP(new Tuple<int, byte[]>(0, new byte[] { 0 }), null));
     Assert.Throws<ArgumentNullException>(() => new IP((IPAddress) null));
     Assert.Throws<ArgumentException>(() => new IP(new Tuple<int, byte[]>(1, new byte[] { 1 }), new MemoryStream()));
     Assert.Throws<FormatException>(() => new IP("test"));
 }
コード例 #2
0
        public void TestException()
        {
            var test = new IP(IPAddress.Any);

            Assert.Throws <ArgumentNullException>(() => test.AppendBytesTo(null));
            Assert.Throws <ArgumentNullException>(() => new IP(0, null));
            Assert.Throws <ArgumentNullException>(() => new IP((IPAddress)null));
            Assert.Throws <ArgumentException>(() => new IP(1, new MemoryStream()));
            Assert.Throws <ArgumentException>(() => new IP("test"));
        }
コード例 #3
0
        public void TestException()
        {
            var test = new IP(IPAddress.Any.GetAddressBytes());

            Assert.Throws <ArgumentNullException>(() => test.AppendBytesTo(null));
            Assert.Throws <ArgumentNullException>(() => new IP(new Tuple <int, byte[]>(0, new byte[] { 0 }), null));
            Assert.Throws <ArgumentNullException>(() => new IP((byte[])null));
            Assert.Throws <ArgumentException>(() => new IP(new Tuple <int, byte[]>(1, new byte[] { 1 }), new MemoryStream()));
            Assert.Throws <FormatException>(() => new IP("test"));
            Assert.Throws <ArgumentNullException>(() => new IP(null, new MemoryStream()));
        }