Example #1
0
        public void Ctor_can_set_the_max_allowed_execution_time()
        {
            TimeSpan maxAllowedExecutionTime = TimeSpan.FromSeconds(4.5);

            var analyzer = new ExecutionTimePerformanceAnalyzer(maxAllowedExecutionTime);

            Assert.Equal(maxAllowedExecutionTime, analyzer.MaxAllowedExecutionTime);
        }
Example #2
0
        public void Analyze_return_null_if_execution_time_is_less_than_max_allowed_execution_time()
        {
            var analyzer = new ExecutionTimePerformanceAnalyzer();

            var report = analyzer.Analyze(DbCommandUtils.CreateCommand("Hi!"), TimeSpan.FromSeconds(0.5));

            Assert.Null(report);
        }
Example #3
0
        public void Analyze_return_report_if_execution_time_exceeds_max_allowed_execution_time()
        {
            var analyzer = new ExecutionTimePerformanceAnalyzer();

            var report = analyzer.Analyze(DbCommandUtils.CreateCommand("Hi!"), TimeSpan.FromSeconds(1.5));

            Assert.NotNull(report);
            Assert.Equal(report.Message, Strings.ExceedsMaxExecutionTime(1.5, 1));
        }