Beispiel #1
0
        public void 文字列を含む場合()
        {
            string ipaddr = "255.255.xxx.255";
            var    ip     = new CheckIP();

            Assert.AreEqual(false, ip.Check(ipaddr));
        }
Beispiel #2
0
        public void 数値が255を超える場合()
        {
            string ipaddr = "255.255.256.255";
            var    ip     = new CheckIP();

            Assert.AreEqual(false, ip.Check(ipaddr));
        }
Beispiel #3
0
        public void ピリオドが多すぎる場合()
        {
            string ipaddr = "255.255.255.255.255.255";
            var    ip     = new CheckIP();

            Assert.AreEqual(false, ip.Check(ipaddr));
        }
Beispiel #4
0
        public void 空欄の場合()
        {
            string ipaddr = "";
            var    ip     = new CheckIP();

            Assert.AreEqual(false, ip.Check(ipaddr));
        }
Beispiel #5
0
        public void localhostを有効にする()
        {
            string ipaddr = "localhost";

            var ip = new CheckIP();

            Assert.AreEqual(true, ip.Check(ipaddr));
            Assert.AreEqual(127, ip.IP1);
            Assert.AreEqual(0, ip.IP2);
            Assert.AreEqual(0, ip.IP3);
            Assert.AreEqual(1, ip.IP4);
            Assert.AreEqual("127.0.0.1", ip.ToString());
        }
Beispiel #6
0
        public void 途中で空欄があっても大丈夫()
        {
            string ipaddr = "127. 0     .0.1   ";

            var ip = new CheckIP();

            Assert.AreEqual(true, ip.Check(ipaddr));
            Assert.AreEqual(127, ip.IP1);
            Assert.AreEqual(0, ip.IP2);
            Assert.AreEqual(0, ip.IP3);
            Assert.AreEqual(1, ip.IP4);
            Assert.AreEqual("127.0.0.1", ip.ToString());
        }