예제 #1
0
        public void Run_Should_Write_Help_Info_And_Exit_With_Zero_If_The_First_Argument_Is_Help()
        {
            CommandDispatcherMock commandDispatcher = CommandDispatcherMock.Create(new[] { "-h" });

            commandDispatcher.Run();

            Assert.Equal(0, _environmentContextMock.ExitValue);
            Assert.NotNull(_consoleContextMock.Text);
            Assert.NotEmpty(_consoleContextMock.Text);
        }
예제 #2
0
        public void Run_Should_Write_Help_Info_And_Exit_With_Zero_If_Argument_Count_Zero()
        {
            CommandDispatcherMock commandDispatcher = CommandDispatcherMock.Create(new string[0]);

            commandDispatcher.Run();

            Assert.Equal(0, _environmentContextMock.ExitValue);
            Assert.NotNull(_consoleContextMock.Text);
            Assert.NotEmpty(_consoleContextMock.Text);
        }
예제 #3
0
        public void Run_Should_Write_Error_And_Exit_With_One_If_The_Arguments_Does_Not_Contains_Valid_ServiceName()
        {
            CommandDispatcherMock commandDispatcher = CommandDispatcherMock.Create(new[] { "-foo -bar" });

            commandDispatcher.Run();

            Assert.Equal(1, _environmentContextMock.ExitValue);
            Assert.NotNull(_consoleContextMock.Text);
            Assert.NotEmpty(_consoleContextMock.Text);
            Assert.StartsWith("ERROR:", _consoleContextMock.Text);
        }
예제 #4
0
        public void Run_Should_Write_Error_And_Exit_With_One_If_Given_ServiceName_Has_Not_Valid_LocalStack_Endpoint()
        {
            CommandDispatcherMock commandDispatcher = CommandDispatcherMock.Create(new[] { "hinesis", "list-streams" });

            commandDispatcher.Config
            .Setup(config => config.GetAwsServiceEndpoints())
            .Returns(() => new List <AwsServiceEndpoint>());

            commandDispatcher.Run();

            Assert.Equal(1, _environmentContextMock.ExitValue);
            Assert.NotNull(_consoleContextMock.Text);
            Assert.NotEmpty(_consoleContextMock.Text);
            Assert.StartsWith("ERROR:", _consoleContextMock.Text);

            commandDispatcher.Config
            .Verify(config => config.GetAwsServiceEndpoints(), Times.Once);
        }