Exemple #1
0
        public async Task <bool> PutAsync(string urlExtension, string id, TEntity model, string token = null)
        {
            _loggerWrapper.LogInformation(nameof(urlExtension) + ": " + urlExtension + " | " + nameof(id) + ": " + id + " | " + nameof(token) + ": " + token, this.GetType().Name, nameof(PutAsync) + "()", null);

            return(await CheckExceptions(async() =>
                                         (await _httwrap.PutAsync(urlExtension + "/" + id, model, null,
                                                                  token != null ? GetCustomHeaders(token) : null)).Success));
        }
Exemple #2
0
        public async void Put_test()
        {
            const string PUT_TEST_PRODUCT_NAME = "Put Test Product";

            Product product = FixtureRepository.Build <Product>().Without(p => p.Id).Create();
            await _client.PostAsync("api/products", product);

            product.Name = PUT_TEST_PRODUCT_NAME;
            IHttwrapResponse putResponse = await _client.PutAsync("api/products/1", product);

            IHttwrapResponse <Product> getResponse = await _client.GetAsync <Product>("api/products/1");

            putResponse.Should().NotBeNull();
            putResponse.StatusCode.Should().Be(HttpStatusCode.NoContent);

            getResponse.Should().NotBeNull();
            getResponse.Data.Should().NotBeNull();
            getResponse.Data.Name.ShouldBeEquivalentTo(PUT_TEST_PRODUCT_NAME);
        }
Exemple #3
0
        public async void Put_test()
        {
            var name = "Put Test Product";

            var product = FixtureRepository.Build <Product>()
                          .With(p => p.Name, name)
                          .Without(p => p.Id)
                          .Create();

            await _client.PostAsync("api/products", product);

            var putResponse = await _client.PutAsync("api/products/1", product);

            var getResponse = await _client.GetAsync <Product>("api/products/1");

            putResponse.Should().NotBeNull();
            putResponse.StatusCode.Should().Be(HttpStatusCode.NoContent);

            getResponse.Should().NotBeNull();
            getResponse.Data.Should().NotBeNull();
            getResponse.Data.Name.ShouldBeEquivalentTo(name);
        }
 protected async Task <IHttwrapResponse> PutAsync(string urlExtension, TEntity model, string token = null) =>
 await CheckExceptions(async() => await _httwrapClient.PutAsync(urlExtension, model, null, token != null ? GetCustomHeaders(token) : null));