Combines multiple already executed IUndoCommands into a single atomic transaction.
Наследование: PreExecutedCommand
        public void TestExecuteUndo()
        {
            var executeCalls = new List<int>(3);
            var undoCalls = new List<int>(3);
            var command = new PreExecutedCompositeCommand(new IUndoCommand[]
            {
                new MockCommand(() => executeCalls.Add(0), () => undoCalls.Add(0)),
                new MockCommand(() => executeCalls.Add(1), () => undoCalls.Add(1)),
                new MockCommand(() => executeCalls.Add(2), () => undoCalls.Add(2))
            });

            command.Execute();
            executeCalls.Should().BeEmpty(because: "First execution should do nothing");

            command.Undo();
            undoCalls.Should().Equal(new[] {2, 1, 0}, because: "Child commands should be undone in descending order");

            command.Execute();
            executeCalls.Should().Equal(new[] {0, 1, 2}, because: "Child commands should be executed in ascending order");
        }
        public void TestExecuteUndo()
        {
            var executeCalls = new List <int>(3);
            var undoCalls    = new List <int>(3);
            var command      = new PreExecutedCompositeCommand(new IUndoCommand[]
            {
                new MockCommand(() => executeCalls.Add(0), () => undoCalls.Add(0)),
                new MockCommand(() => executeCalls.Add(1), () => undoCalls.Add(1)),
                new MockCommand(() => executeCalls.Add(2), () => undoCalls.Add(2))
            });

            command.Execute();
            executeCalls.Should().BeEmpty(because: "First execution should do nothing");

            command.Undo();
            undoCalls.Should().Equal(new[] { 2, 1, 0 }, because: "Child commands should be undone in descending order");

            command.Execute();
            executeCalls.Should().Equal(new[] { 0, 1, 2 }, because: "Child commands should be executed in ascending order");
        }