public void AddBatch(string batchId, IBatchCloser batchCloser)
 {
     if (!batchClosers_.ContainsKey(batchId))
     {
         batchClosers_.Add(batchId, batchCloser);
     }
 }
 private void DeleteAllBatches_()
 {
     foreach (KeyValuePair <string, IBatchCloser> kvp in batchClosers_)
     {
         IBatchCloser connector = kvp.Value;
         connector.CloseBatch(kvp.Key);
     }
 }
Exemplo n.º 3
0
 private void DeleteAllBatches_()
 {
     if (DontCloseBatches)
     {
         return;
     }
     Logger.Log(TraceLevel.Notice, Stage.Close, StageType.CloseBatch, new { batches = batchClosers_.Keys });
     foreach (KeyValuePair <string, IBatchCloser> kvp in batchClosers_)
     {
         IBatchCloser connector = kvp.Value;
         connector.CloseBatch(kvp.Key);
     }
 }
Exemplo n.º 4
0
        public void TestBatchCloseFlag()
        {
            CommonUtils.DontCloseBatches = false;
            IBatchCloser first  = Substitute.For <IBatchCloser>();
            IBatchCloser second = Substitute.For <IBatchCloser>();
            IBatchCloser third  = Substitute.For <IBatchCloser>();
            Dictionary <string, IBatchCloser> batchCloserMap = new Dictionary <string, IBatchCloser>();

            batchCloserMap.Add("first", first);
            batchCloserMap.Add("second", second);
            batchCloserMap.Add("third", third);

            // default
            VisualGridRunner runner = InitRunnerWithBatches_(batchCloserMap, nameof(TestBatchCloseFlag) + "_default");

            runner.GetAllTestResults();
            first.Received().CloseBatch("first");
            second.Received().CloseBatch("second");
            third.Received().CloseBatch("third");

            // set true
            first.ClearReceivedCalls();
            second.ClearReceivedCalls();
            third.ClearReceivedCalls();

            runner = InitRunnerWithBatches_(batchCloserMap, nameof(TestBatchCloseFlag) + "_true");
            runner.DontCloseBatches = true;
            runner.GetAllTestResults();
            first.DidNotReceive().CloseBatch("first");
            second.DidNotReceive().CloseBatch("second");
            third.DidNotReceive().CloseBatch("third");

            // set false
            first.ClearReceivedCalls();
            second.ClearReceivedCalls();
            third.ClearReceivedCalls();
            runner = InitRunnerWithBatches_(batchCloserMap, nameof(TestBatchCloseFlag) + "_false");
            runner.DontCloseBatches = false;
            runner.GetAllTestResults();
            first.Received().CloseBatch("first");
            second.Received().CloseBatch("second");
            third.Received().CloseBatch("third");
        }
Exemplo n.º 5
0
 public void AddBatch(string batchId, IBatchCloser batchCloser)
 {
     batchClosers_.TryAdd(batchId, batchCloser);
 }