Пример #1
0
        public void alertTest()
        {
            AlertClient.SetOpation(new AlertOpation
            {
                AppId   = "chejiatiantianbao",
                Service = "service399",
                Url     = "http://172.20.12.58:9093/api/v1/alerts"
            });

            Exception ex = null;

            try
            {
                var a = 0;
                var d = 1 / a;
            }
            catch (Exception e)
            {
                ex = e;
            }


            Task.Run(async() =>
            {
                for (int i = 0; i < 5; i++)
                {
                    bool ss = await AlertClient.SendAlertAsync("²âÊÔ±¨´í1", "²ÎÊý:" + i.ToString(), null, ex);
                    Assert.IsTrue(ss);
                }
                // Actual test code here.
            }).GetAwaiter().GetResult();
        }
Пример #2
0
        static void Main(string[] args)
        {
            AlertClient.SetOpation(new AlertOpation
            {
                AppId   = "chejiatiantianbao",
                Service = "service3991",
                Url     = "http://172.20.12.58:9093/api/v1/alerts"
            });

            Task.Run(async() =>
            {
                await AlertClient.SendAlertAsync("测试报错1", "参数", null, new Exception("错误1"));
            }).GetAwaiter().GetResult();
        }