public async Task When_Update_Resource_And_No_Id_Is_Specified_Then_Error_Is_Returned()
        {
            // ARRANGE
            InitializeFakeObjects();
            _httpClientFactoryStub.Setup(h => h.GetHttpClient()).Returns(_server.Client);

            // ACT
            var resource = await _resourceSetClient.UpdateByResolution(new PutResourceSet(), baseUrl + "/.well-known/uma2-configuration", "header");

            // ASSERT
            Assert.NotNull(resource);
            Assert.True(resource.ContainsError);
            Assert.Equal("invalid_request", resource.Error.Error);
            Assert.Equal("the parameter id needs to be specified", resource.Error.ErrorDescription);
        }
        public async Task When_Updating_Resource_Then_Changes_Are_Persisted()
        {
            const string baseUrl = "http://localhost:5000";

            // ARRANGE
            InitializeFakeObjects();
            _httpClientFactoryStub.Setup(h => h.GetHttpClient()).Returns(_server.Client);
            var resource = await _resourceSetClient.AddByResolution(new PostResourceSet
            {
                Name   = "name",
                Scopes = new List <string>
                {
                    "scope"
                }
            },
                                                                    baseUrl + "/.well-known/uma-configuration", "header");

            // ACT
            var updateResult = await _resourceSetClient.UpdateByResolution(new PutResourceSet
            {
                Id     = resource.Id,
                Name   = "name2",
                Type   = "type",
                Scopes = new List <string>
                {
                    "scope2"
                }
            }, baseUrl + "/.well-known/uma-configuration", "header");

            var information = await _resourceSetClient.GetByResolution(updateResult.Id, baseUrl + "/.well-known/uma-configuration", "header");

            // ASSERT
            Assert.NotNull(information);
            Assert.True(information.Name == "name2");
            Assert.True(information.Type == "type");
            Assert.True(information.Scopes.Count() == 1 && information.Scopes.First() == "scope2");
        }