public void TestSubCommandWorksCorrectlyInModel(bool autoExecute, string bla, int i, int n)
        {
            var lock1 = new ManualResetEventSlim();
            var lock2 = new ManualResetEventSlim();

            var containerResolver = new CustomInstantiator(lock1, lock2, autoExecute, bla, i, n);

            var parser = new CommandLineParser <MainModel>(containerResolver);

            var result = parser.Parse(new[] { "main", "-b", bla, "sub", "-i", i.ToString(), "-n", n.ToString() });

            result.AssertNoErrors();

            if (!autoExecute)
            {
                Assert.All(result.CommandResults.Select(r => r.Executed), Assert.False);

                result.ExecuteCommands();
            }

            Assert.True(lock1.Wait(1000), "MainCommand didn't execute in time.");
            Assert.True(lock2.Wait(1000), "SubCommand didn't execute in time.");

            Assert.All(result.CommandResults.Select(r => r.Executed), Assert.True);
        }
        public void TestSubCommandWorksCorrectlyInModel(bool autoExecute)
        {
            var lock1 = new ManualResetEventSlim();
            var lock2 = new ManualResetEventSlim();

            var containerResolver = new CustomInstantiator(lock1, lock2, autoExecute);

            var parser = new CommandLineParser <MainModel>(containerResolver);

            var result = parser.Parse(new[] { "main", "-b", "something", "sub", "-i", "15", "-n", "-1" });

            result.AssertNoErrors();

            if (!autoExecute)
            {
                result.ExecuteCommands();
            }

            Assert.True(lock1.Wait(1000), "MainCommand didn't execute in time.");
            Assert.True(lock2.Wait(1000), "SubCommand didn't execute in time.");
        }