Exemple #1
0
        public void IcmpPingerTest()
        {
            var icmpPinger = new IcmpPinger(new TestLogger());


            Assert.DoesNotThrow(() => { icmpPinger.Ping("8.8.8.8", 443, 2); });

            Assert.Throws <Exception>(() => { icmpPinger.Ping("WrongUrl", 443, 2); });
        }
        public void LoggingTest()
        {
            var icmppinger = new IcmpPinger();
            var answer     = icmppinger.Ping(rowhosts);

            foreach (var item in answer.Result)
            {
                icmppinger.Logging(item.Key, item.Value);
            }

            File.Delete(logpath);
        }
        public void PingTest()
        {
            var rowhostskeys = new List <string>(File.ReadAllLines("./Hosts.txt"));

            foreach (var item in rowhostskeys)
            {
                rowhosts.Add(item, item);
            }
            var icmppinger = new IcmpPinger();
            var actual     = new Dictionary <string, string>();
            var expected   = icmppinger.Ping(rowhosts).Result;

            actual.Add("https://www.google.com/", "FAILED");
            actual.Add("https://www.google1234455435435.com/", "FAILED");
            actual.Add("216.58.207.78", "OK");
            actual.Add("34.22.1.23", "FAILED");
            Assert.AreEqual(expected, actual);
        }