Exemple #1
0
        public void CleanCache_Any_DoesNotThrow()
        {
            var query = "select 1;";
            var cmd   = new OleDbCommand(query, new OleDbConnection(ConnectionStringReader.GetLocalOleDbSql()));

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

            Assert.DoesNotThrow(() => qp.CleanCache());
        }
Exemple #2
0
        public void Execute_OneQueryHavingTimeout_ReturnTimeoutInfo()
        {
            var query = "WAITFOR DELAY '00:00:03';";
            var cmd   = new OleDbCommand(query, new OleDbConnection(ConnectionStringReader.GetOleDbSql()));

            var qp  = new OleDbPerformanceEngine(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);
        }
Exemple #3
0
        public void CheckPerformance_OneQuery_ReturnElapsedTime()
        {
            var sql = "WAITFOR DELAY '00:00:00';";
            var cmd = new OleDbCommand(sql, new OleDbConnection(ConnectionStringReader.GetOleDbSql()));

            var qp  = new OleDbPerformanceEngine(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);
        }