public void Should_order_Stages()
        {
            var stages     = GetDaemonStages();
            var dispatcher = new DaemonStageDispatcher(stages);

            bool CheckForInterrupt() => false;

            dispatcher.Execute(sourceFile, CheckForInterrupt);
            AssertOrderedStages(dispatcher.OrderedDaemonStages);
        }
Esempio n. 2
0
 static void Main(string[] args)
 {
     var executedStages = new List <string>();
     var A          = new TestDaemonStage("A", new string[] { }, new[] { "C", "D", "E" });
     var B          = new TestDaemonStage("B", new[] { "A" }, new[] { "D", "E" });
     var C          = new TestDaemonStage("C", new string[] { }, new[] { "D", "E" });
     var D          = new TestDaemonStage("D", new[] { "A", "B", "C" }, new string[] { });
     var E          = new TestDaemonStage("E", new[] { "C" }, new string[] { });
     var dispatcher = new DaemonStageDispatcher(new IDaemonStage[] { D, A, B, C, E });
     var names      = dispatcher.OrderedDaemonStages.Select(it => it.Name);
 }
        public void Should_execute_stages_and_interrupt()
        {
            var stopCount  = 3;
            var stages     = GetDaemonStages();
            var dispatcher = new DaemonStageDispatcher(stages);

            var         interruptCounter  = new InterruptCounter(stopCount * 2);
            Func <bool> checkForInterrupt = interruptCounter.Inter;

            dispatcher.Execute(sourceFile, checkForInterrupt);

            dispatcher
            .OrderedDaemonStages
            .Count(it => ((TestDaemonStage)it).Executed)
            .ShouldBeEquivalentTo(stopCount);
        }