Inheritance: IHelpProvider
        public void Constructor_AllParametersAreSet_ObjectIsInstantiated()
        {
            // Arrange
            var applicationInformation = new ApplicationInformation();
            var userInterface = new Mock<IUserInterface>();

            // Act
            var helpProvider = new HelpProvider(applicationInformation, userInterface.Object);

            // Assert
            Assert.IsNotNull(helpProvider);
        }
        public void ShowHelpOverview_ApplicationName_IsWrittenToTheUserInterface()
        {
            // Arrange
            var commands = new List<ICommand>();

            var applicationInformation = new ApplicationInformation { ApplicationName = "App Name" };

            var helpProvider = new HelpProvider(applicationInformation, this.loggingUserInterface.UserInterface);

            // Act
            helpProvider.ShowHelpOverview(commands);

            // Assert
            Assert.IsTrue(this.loggingUserInterface.UserInterfaceOutput.Contains(applicationInformation.ApplicationName));
        }
        public void ShowHelp_SuppliedCommandIsNull_ArgumentNullExceptionIsThrown()
        {
            // Arrange
            ICommand command = null;

            var applicationInformation = new ApplicationInformation();
            var userInterface = new Mock<IUserInterface>();

            var helpProvider = new HelpProvider(applicationInformation, userInterface.Object);

            // Act
            helpProvider.ShowHelp(command);
        }
        public void ShowHelp_Examples_AreWrittenToTheUserInterface()
        {
            // Arrange
            ICommand command = CommandTestUtilities.GetCommand("SomeCommand");

            var applicationInformation = new ApplicationInformation();

            var helpProvider = new HelpProvider(applicationInformation, this.loggingUserInterface.UserInterface);

            // Act
            helpProvider.ShowHelp(command);

            // Assert
            foreach (var example in command.Attributes.Examples)
            {
                Assert.IsTrue(this.loggingUserInterface.UserInterfaceOutput.Contains(example.Key));
                Assert.IsTrue(this.loggingUserInterface.UserInterfaceOutput.Contains(example.Value));
            }
        }
        public void ShowHelp_CommandName_IsWrittenToTheUserInterface()
        {
            // Arrange
            ICommand command = CommandTestUtilities.GetCommand("SomeCommand");

            var applicationInformation = new ApplicationInformation();

            var helpProvider = new HelpProvider(applicationInformation, this.loggingUserInterface.UserInterface);

            // Act
            helpProvider.ShowHelp(command);

            // Assert
            Assert.IsTrue(this.loggingUserInterface.UserInterfaceOutput.Contains(command.Attributes.CommandName));
        }
        public void ShowHelpOverview_CommandsParameterIsNull_ArgumentNullExceptionIsThrown()
        {
            // Arrange
            List<ICommand> commands = null;

            var applicationInformation = new ApplicationInformation();
            var userInterface = new Mock<IUserInterface>();

            var helpProvider = new HelpProvider(applicationInformation, userInterface.Object);

            // Act
            helpProvider.ShowHelpOverview(commands);
        }
        public void ShowHelpOverview_CommandNameOfEachAvailableCommand_IsWrittenToTheUserInterface()
        {
            // Arrange
            var commands = new List<ICommand>
                { CommandTestUtilities.GetCommand("test"), CommandTestUtilities.GetCommand("update"), CommandTestUtilities.GetCommand("delete") };

            var applicationInformation = new ApplicationInformation { NameOfExecutable = "AppName.exe" };

            var helpProvider = new HelpProvider(applicationInformation, this.loggingUserInterface.UserInterface);

            // Act
            helpProvider.ShowHelpOverview(commands);

            // Assert
            foreach (var command in commands)
            {
                Assert.IsTrue(this.loggingUserInterface.UserInterfaceOutput.Contains(command.Attributes.CommandName));
            }
        }