public void Pop_TwoCommandsWithIdleUpdate_AllCommandsExtracted() { // ARRANGE var command1 = new Mock <ICommand>().Object; var command2 = new Mock <ICommand>().Object; var commandManager = new QueueCommandPool(); // ACT commandManager.Push(command1); var factCommand1 = commandManager.Pop(); // Холостой Update. var idleCommand = commandManager.Pop(); // Вторая команда должна быть извлечена. commandManager.Push(command2); var factCommand2 = commandManager.Pop(); // ASSERT factCommand1.Should().Be(command1); idleCommand.Should().BeNull(); factCommand2.Should().Be(command2); }
private static void AssertPopCommands(ICommand[] commands, QueueCommandPool commandManager) { foreach (var expectedCommand in commands) { var factCommand = commandManager.Pop(); // ASSERT factCommand.Should().Be(expectedCommand); } }
public void Pop_GetOneCommand_AllCommandsExtracted() { // ARRANGE var commands = GetOneCommand(); var commandManager = new QueueCommandPool(); foreach (var command in commands) { commandManager.Push(command); } // ACT AssertPopCommands(commands, commandManager); }