Пример #1
0
        public Task ShouldExecuteCommandWhenCorrectCommandLineParametersArePassedWithSpaceName()
        {
            var client = Substitute.For <IOctopusAsyncClient>();

            ClientFactory.CreateAsyncClient(null).ReturnsForAnyArgs(client);

            Repository.Spaces.FindByName(Arg.Any <string>()).Returns(new SpaceResource {
                Id = "Spaces-2"
            });
            client.ForSystem().Returns(Repository);

            apiCommand = new DummyApiCommand(RepositoryFactory, FileSystem, ClientFactory, CommandOutputProvider);
            var argsWithSpaceName = CommandLineArgs.Concat(new [] { "--space=abc" });

            return(apiCommand.Execute(argsWithSpaceName.ToArray()));
        }
Пример #2
0
        public void ShouldThrowWhenThereIsNoSpaceMatchTheProvidedName()
        {
            var client = Substitute.For <IOctopusAsyncClient>();

            ClientFactory.CreateAsyncClient(null).ReturnsForAnyArgs(client);

            Repository.Spaces.FindByName("test").Returns(new SpaceResource {
                Id = "Spaces-2", Name = "test"
            });
            client.ForSystem().Returns(Repository);

            apiCommand = new DummyApiCommand(RepositoryFactory, FileSystem, ClientFactory, CommandOutputProvider);
            var argsWithSpaceName = CommandLineArgs.Concat(new[] { "--space=nonExistent" });

            Func <Task> action = async() => await apiCommand.Execute(argsWithSpaceName.ToArray()).ConfigureAwait(false);

            action.ShouldThrow <CommandException>().WithMessage("Cannot find the space with name or id 'nonExistent'. Please check the spelling and that you have permissions to view it. Please use Configuration > Test Permissions to confirm.");
        }
Пример #3
0
 public void SetUp()
 {
     apiCommand = new DummyApiCommand(RepositoryFactory, FileSystem, ClientFactory, CommandOutputProvider);
 }