public async Task update_my_announcements_happy_path() { CreateMyAnnouncementResponse createMyAnnouncementResponse = await _announcementCommonActions.CreateMyAnnouncementAsync(new CreateMyAnnouncementRequest() { Description = "I am selling an almost new ps3 video game.", Price = 199, Title = "Almost new ps3" }, NoRoleToken).ConfigureAwait(false); UpdateMyAnnouncementResponse updateMyAnnouncementResponse = await _announcementCommonActions.UpdateMyAnnouncementAsync(createMyAnnouncementResponse.Id, new UpdateMyAnnouncementRequest() { Description = "I am selling an almost new ps3 video game.", Price = 99, Title = "Almost new ps3" }, NoRoleToken).ConfigureAwait(false); updateMyAnnouncementResponse.Price.Should().Be(99); }
/// <summary> /// Atualiza os dados de um anúncio /// </summary> /// <param name="id">Identificador do anúncio</param> /// <param name="updateMyAnnouncementRequest">Novos dados</param> /// <param name="authToken">Autenticação</param> /// <returns>Sucesso</returns> public async Task <UpdateMyAnnouncementResponse> UpdateMyAnnouncementAsync( long id, UpdateMyAnnouncementRequest updateMyAnnouncementRequest, string authToken) { _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken); HttpResponseMessage response = await _httpClient.PutAsync( Endpoints.Announcement.MyAnnouncementsPut_v1_0(id), updateMyAnnouncementRequest.ToStringContent()).ConfigureAwait(false); response.StatusCode.Should().Be(HttpStatusCode.OK); string bodyResponse = await response.Content.ReadAsStringAsync().ConfigureAwait(false); UpdateMyAnnouncementResponse updateMyAnnouncementResponse = JsonConvert.DeserializeObject <UpdateMyAnnouncementResponse>( bodyResponse); updateMyAnnouncementResponse.Should().NotBeNull(); updateMyAnnouncementResponse.UpdatedOn.Should().NotBeNull(); updateMyAnnouncementResponse.Id.Should().Be(id); return(updateMyAnnouncementResponse); }