示例#1
0
        public void HttpPingerTest()
        {
            var httpPinger = new HttpPinger(new TestLogger());


            Assert.DoesNotThrow(() => { httpPinger.Ping("http://ya.ru", 443, 2); });

            Assert.Throws <Exception>(() => { httpPinger.Ping("WrongUrl", 443, 2); });
        }
示例#2
0
        public void LoggingTest()
        {
            var httppinger = new HttpPinger();
            var answer     = httppinger.Ping(rowhosts);

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

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

            foreach (var item in rowhostskeys)
            {
                rowhosts.Add(item, item);
            }

            var httppinger   = new HttpPinger();
            var actual       = new Dictionary <string, string>();
            var expectedTask = httppinger.Ping(rowhosts);
            var expected     = expectedTask.Result;

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