Пример #1
0
        public TestMonitor Add(ITest test)
        {
            var key       = test.GetType().FullName;
            var keyFormat = key + ".{0}";
            var i         = 1;

            while (!tests.TryAdd(key, test))
            {
                key = string.Format(keyFormat, i);
                i++;
            }
            var monitor = monitors.GetOrAdd(key, (k) =>
            {
                var m = new TestMonitor(this, k, test)
                {
                    HttpContext = this.HttpContext
                };
                m.Started         += OnTestStarted;
                m.Completed       += OnTestCompleted;
                m.EventReceived   += OnTestEventReceived;
                m.ProgressChanged += OnProgressChanged;
                return(m);
            });

            return(monitor);
        }
 public TestMonitor Add(ITest test)
 {
     var key = test.GetType().FullName;
     var keyFormat = key + ".{0}";
     var i = 1;
     while (!tests.TryAdd(key, test))
     {
         key = string.Format(keyFormat, i);
         i++;
     }
     var monitor = monitors.GetOrAdd(key, (k) =>
     {
         var m = new TestMonitor(this, k, test) { HttpContext = this.HttpContext };
         m.Started += OnTestStarted;
         m.Completed += OnTestCompleted;
         m.EventReceived += OnTestEventReceived;
         m.ProgressChanged += OnProgressChanged;
         return m;
     });
     return monitor;
 }