Exemplo n.º 1
0
        private string[] CreateArguments(string identityResourceName, string[] userClaims, params string[] args)
        {
            var mainArgs       = new[] { CommandName, SubCommandName, identityResourceName };
            var userClaimsArgs = CommandLineApplicationUtils.CreateMultipleOptionArguments("--user-claims", userClaims);

            return(mainArgs.Concat(userClaimsArgs)
                   .Concat(args)
                   .ToArray());
        }
Exemplo n.º 2
0
        public NewClientCommandTest()
        {
            this._console          = A.Fake <IConsole>();
            this._clientRepository = A.Fake <IClientRepository>();
            var newClientCmd = new NewClientCommand(this._console, this._clientRepository);

            this._commandLineApp = CommandLineApplicationUtils.CreateCommandLineApplication(
                CommandName, SubCommandName, newClientCmd
                );
        }
Exemplo n.º 3
0
        public ListApiResourcesCommandTest()
        {
            this._console = A.Fake <IConsole>();
            this._apiResourceRepository = A.Fake <IApiResourceRepository>();
            var listApiResourceCmd = new ListApiResourcesCommand(this._console, this._apiResourceRepository);

            this._commandLineApp = CommandLineApplicationUtils.CreateCommandLineApplication(
                CommandName, SubCommandName, listApiResourceCmd
                );
        }
Exemplo n.º 4
0
        public NewIdentityResourceCommandTest()
        {
            this._console = A.Fake <IConsole>();
            this._identityResourceRepository = A.Fake <IIdentityResourceRepository>();
            var newIdentityResourceCmd = new NewIdentityResourceCommand(this._console, this._identityResourceRepository);

            this._commandLineApp = CommandLineApplicationUtils.CreateCommandLineApplication(
                CommandName, SubCommandName, newIdentityResourceCmd
                );
        }
Exemplo n.º 5
0
        public void ShouldCreateANewClientWithAllowedCorsOrigins(
            string clientId, string[] allowedCorsOrigins
            )
        {
            var allowedCorsOriginsArgs =
                CommandLineApplicationUtils.CreateMultipleOptionArguments("--allowed-cors-origins", allowedCorsOrigins)
                .ToArray();
            var args = CreateArguments(clientId, allowedCorsOriginsArgs);

            this._commandLineApp.Execute(args);

            AddAsyncMustHaveHappenedWithApiResourceThat(
                c => c.ClientId == clientId &&
                c.AllowedCorsOrigins.All(r => allowedCorsOriginsArgs.Contains(r)));
            SuccessMessageMustHaveHappened();
        }
Exemplo n.º 6
0
        public void ShouldCreateANewClientWithPostLogoutRedirectUris(
            string clientId, string[] postLogoutRedirectUris
            )
        {
            var postLogoutRedirectUrisArgs = CommandLineApplicationUtils.CreateMultipleOptionArguments(
                "--post-logout-redirect-uris", postLogoutRedirectUris)
                                             .ToArray();
            var args = CreateArguments(clientId, postLogoutRedirectUrisArgs);

            this._commandLineApp.Execute(args);

            AddAsyncMustHaveHappenedWithApiResourceThat(
                c => c.ClientId == clientId &&
                c.RedirectUris.All(r => postLogoutRedirectUrisArgs.Contains(r)));
            SuccessMessageMustHaveHappened();
        }
Exemplo n.º 7
0
        public void ShouldCreateANewApiResourceWithTheInformedClaims(string apiResourceName, string[] claims)
        {
            var mainArgs = new string[] {
                CommandName, SubCommandName, apiResourceName
            };
            var userClaimsArgs = CommandLineApplicationUtils.CreateMultipleOptionArguments("--user-claims", claims);

            var args = mainArgs.Concat(userClaimsArgs).ToArray();

            this._commandLineApp.Execute(args);

            AddAsyncMustHaveHappenedWithApiResourceThat(
                a => a.Name == apiResourceName &&
                a.UserClaims.All(c => claims.Contains(c)));
            SuccessMessageMustHaveHappened();
        }
Exemplo n.º 8
0
        public void ShouldCreateANewApiResourceWithTheInformedScopes(string apiResourceName, string[] scopes)
        {
            var mainArgs = new string[] {
                CommandName, SubCommandName, apiResourceName
            };
            var scopesArgs = CommandLineApplicationUtils.CreateMultipleOptionArguments("--scopes", scopes);

            var args = mainArgs.Concat(scopesArgs).ToArray();

            this._commandLineApp.Execute(args);

            AddAsyncMustHaveHappenedWithApiResourceThat(
                a => a.Name == apiResourceName &&
                a.Scopes.All(s => scopes.Contains(s.Name)));
            SuccessMessageMustHaveHappened();
        }