Ejemplo n.º 1
0
        public void CheckPerformance_OneQuery_ReturnElapsedTime()
        {
            var sql = "WAITFOR DELAY '00:00:00';";
            var cmd = new SqlCommand(sql, new SqlConnection(ConnectionStringReader.GetSqlClient()));

            var qp = new QueryEngineFactory().GetPerformance(cmd);
            var res = qp.CheckPerformance();

            Assert.That(res.TimeElapsed.TotalMilliseconds, Is.GreaterThanOrEqualTo(0).And.LessThan(5000));
            Assert.That(res.IsTimeOut, Is.False);
        }
Ejemplo n.º 2
0
        public void CheckPerformance_OneQueryHavingTimeout_ReturnTimeoutInfo()
        {
            var sql = "WAITFOR DELAY '00:00:03';";
            var cmd = new SqlCommand(sql, new SqlConnection(ConnectionStringReader.GetSqlClient()));

            var qp = new QueryEngineFactory().GetPerformance(cmd);
            var res = qp.CheckPerformance(1000);

            Assert.That(res.TimeOut.TotalMilliseconds, Is.EqualTo(1000));
            Assert.That(res.IsTimeOut, Is.True);
        }