Inheritance: IHelpProvider
Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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));
            }
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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));
            }
        }