예제 #1
0
        public void TestSameCommandParallelExecution()
        {
            Utils.CleanContext();
            var builder  = Utils.CreateBuilder(false);
            var commands = new List <Command>();

            for (int i = 0; i < 100; ++i)
            {
                TestCommand.ResetCounter();
                commands.Add(new DummyBlockingCommand {
                    Delay = 100
                });
            }

            IEnumerable <BuildStep> steps = builder.Root.Add(commands);

            builder.Run(Builder.Mode.Build);

            int successful = 0;
            int notTriggeredWasSuccessful = 0;

            foreach (BuildStep step in steps)
            {
                if (step.Status == ResultStatus.Successful)
                {
                    ++successful;
                }
                if (step.Status == ResultStatus.NotTriggeredWasSuccessful)
                {
                    ++notTriggeredWasSuccessful;
                }
            }

            Assert.That(successful, Is.EqualTo(1));
            Assert.That(notTriggeredWasSuccessful, Is.EqualTo(commands.Count - 1));
        }
예제 #2
0
 public void TestSpawnAndAwaitCommands()
 {
     Utils.CleanContext();
     ExecuteSimpleBuilder(ResultStatus.Successful);
 }