コード例 #1
0
        public void CleanCache_Any_DoesNotThrow()
        {
            var query = "select 1;";
            var cmd   = new OdbcCommand(query, new OdbcConnection(ConnectionStringReader.GetLocalOdbcSql()));

            var qp = new OdbcPerformanceEngine(cmd.Connection, cmd);

            Assert.DoesNotThrow(() => qp.CleanCache());
        }
コード例 #2
0
        public void Execute_OneQueryHavingTimeout_ReturnTimeoutInfo()
        {
            var query = "WAITFOR DELAY '00:00:03';";
            var cmd   = new OdbcCommand(query, new OdbcConnection(ConnectionStringReader.GetOdbcSql()));

            var qp  = new OdbcPerformanceEngine(cmd.Connection, cmd);
            var res = qp.Execute(new TimeSpan(0, 0, 1));

            Assert.That(res.TimeOut.TotalMilliseconds, Is.EqualTo(1000));
            Assert.That(res.IsTimeOut, Is.True);
        }
コード例 #3
0
        public void CheckPerformance_OneQuery_ReturnElapsedTime()
        {
            var sql = "WAITFOR DELAY '00:00:00';";
            var cmd = new OdbcCommand(sql, new OdbcConnection(ConnectionStringReader.GetOdbcSql()));

            var qp  = new OdbcPerformanceEngine(cmd.Connection, cmd);
            var res = qp.Execute(new TimeSpan(0, 1, 0));

            Assert.That(res.TimeElapsed.TotalMilliseconds, Is.GreaterThanOrEqualTo(0).And.LessThan(5000));
            Assert.That(res.IsTimeOut, Is.False);
        }