Beispiel #1
0
        public async Task Delete_Client_Grants_OK()
        {
            var client = TestsHelper.GetClient(null, HttpStatusCode.NoContent);
            var result = await client.ClientGrants.DeleteAsync(Guid.NewGuid().ToString());

            Assert.True(result);
        }
Beispiel #2
0
        public async Task Get_Client_Grants_Paged_OK()
        {
            var response = new ClientGrantsPagedResponse()
            {
                Total        = 3,
                Limit        = 3,
                Start        = 4,
                ClientGrants = new[]
                {
                    new ClientGrantsResponse()
                    {
                        Id       = Guid.NewGuid().ToString(),
                        ClientId = Guid.NewGuid().ToString(),
                        Audience = Guid.NewGuid().ToString(),
                        Scope    = new[]
                        {
                            Guid.NewGuid().ToString(),
                        }
                    }
                }
            };
            var client = TestsHelper.GetClient(response, HttpStatusCode.OK);
            var result = await client.ClientGrants.GetPagedAsync(25, 0);

            Assert.Equal(response.Limit, result.Limit);
            Assert.Equal(response.Total, result.Total);
            Assert.Equal(response.Start, result.Start);
        }
Beispiel #3
0
        public async Task Create_Client_Grants_Ok()
        {
            var client = TestsHelper.GetClient(null, HttpStatusCode.Created);
            var result = await client.ClientGrants.CreateAsync(new ClientGrantRequest()
            {
                Audience = "test", ClientId = "test"
            });

            Assert.True(result);
        }
Beispiel #4
0
        public async Task Get_Branding_BadRequest()
        {
            var response = new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.BadRequest,
                Content    = new StringContent("Invalid request body. The message will vary depending on the cause.", Encoding.UTF8,
                                               "application/text")
            };

            var client = TestsHelper.GetClient(response);

            await Assert.ThrowsAsync <ManagementClientException>(async() => await client.Branding.GetAsync());
        }
Beispiel #5
0
        public async Task Get_Branding_OK()
        {
            var url      = new Uri("https://www.google.com");
            var response = new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(
                    "{ \"favicon_url\": \"" + url.ToString() + "\", \"logo_url\": \"" + url.ToString() + "\" }", Encoding.UTF8,
                    "application/json")
            };
            var client = TestsHelper.GetClient(response);

            var result = await client.Branding.GetAsync();

            Assert.Equal(url, result.LogoUrl);
            Assert.Equal(url, result.FaviconUrl);
        }
Beispiel #6
0
        public async Task Update_Client_Grants_OK()
        {
            var response = new ClientGrantsResponse()
            {
                Audience = Guid.NewGuid().ToString(),
                ClientId = Guid.NewGuid().ToString(),
                Id       = Guid.NewGuid().ToString()
            };
            var client  = TestsHelper.GetClient(response, HttpStatusCode.OK);
            var request = new UpdateClientGrantRequest()
            {
                Scope = new[] { Guid.NewGuid().ToString() }
            };
            var result = await client.ClientGrants.UpdateAsync(Guid.NewGuid().ToString(), request);

            Assert.IsType <ClientGrantsResponse>(result);
        }
Beispiel #7
0
        public async Task Get_Client_Grants_OK()
        {
            var response = new[]
            {
                new ClientGrantsResponse()
                {
                    Id       = Guid.NewGuid().ToString(),
                    ClientId = Guid.NewGuid().ToString(),
                    Audience = Guid.NewGuid().ToString(),
                    Scope    = new[]
                    {
                        Guid.NewGuid().ToString(),
                    }
                }
            };

            var client = TestsHelper.GetClient(response, HttpStatusCode.OK);
            var result = await client.ClientGrants.GetAsync();

            Assert.Equal(response[0].Id, result[0].Id);
            Assert.Equal(response[0].ClientId, result[0].ClientId);
            Assert.Equal(response[0].Audience, result[0].Audience);
            Assert.Equal(response[0].Scope, result[0].Scope);
        }