コード例 #1
0
ファイル: Program.cs プロジェクト: visualeyes/budgerigar
        static void Main(string[] args)
        {
            var budgetter = new PerformanceBudgetter();

            budgetter.RunWithBudget("over-budget", 1, LongRunningTask, LogResult);
            budgetter.RunWithBudget("under-budget", 100, LongRunningTask, LogResult);

            Console.ReadLine();
        }
コード例 #2
0
        public void Returns_Budget_If_Timer_Null()
        {
            var budgetter = new PerformanceBudgetter(null);
            var budget = budgetter.RunWithBudget("test", 1.0M, null);

            Assert.NotNull(budget);
        }
コード例 #3
0
        public void Default_Constructor_Returns_Budget()
        {
            var budgetter = new PerformanceBudgetter();

            var budget = budgetter.RunWithBudget("test", 1.0M, null);

            Assert.NotNull(budget);
        }
コード例 #4
0
        public void Returns_Budget()
        {
            var timer = new PerformanceTimerProviderFactory(new StopwatchTimerProvider());
            var budgetter = new PerformanceBudgetter(timer);

            var budget = budgetter.RunWithBudget("test", 1.0M, null);

            Assert.NotNull(budget);
        }
コード例 #5
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            string url = filterContext.HttpContext.Request.Url.ToString();

            var budgetter = new PerformanceBudgetter();

            var budget = budgetter.RunWithBudget(url, budgetMs, onCompletion);

            SetPerformaceBudgetterFromContext(budget, filterContext);
        }