Наследование: SEEK.AdPostingApi.Client.Models.Advertisement, IResource
Пример #1
0
        private void AssertRetrievedAdvertisementMatchesExpected(AllFieldsInitializer builderInitializer, string advertisementId, AdvertisementResource result)
        {
            AdvertisementResource expectedResult = new AdvertisementResourceBuilder(builderInitializer)
                .WithId(new Guid(advertisementId))
                .WithLinks(advertisementId)
                .WithProcessingStatus(ProcessingStatus.Pending)
                .WithAgentId(null)
                .Build();

            result.ShouldBeEquivalentTo(expectedResult);
        }
        private void AssertReturnedAdvertisementMatchesExpectedExpiredAdvertisement(string advertisementId, DateTime expiryDate, AdvertisementResource result)
        {
            AdvertisementResource expectedResult = new AdvertisementResourceBuilder(this.AllFieldsInitializer)
                .WithId(new Guid(advertisementId))
                .WithLinks(advertisementId)
                .WithState(AdvertisementState.Expired)
                .WithExpiryDate(expiryDate)
                .WithAgentId(null)
                .Build();

            result.ShouldBeEquivalentTo(expectedResult);
        }
Пример #3
0
        private static async Task<AdvertisementResource> ExpireAdvertisementExampleAsync(AdvertisementResource advertisement)
        {
            AdvertisementResource advertisementResource = null;
            try
            {
                await TransientErrorRetryPolicy.ExecuteAsync(async () => advertisementResource = await advertisement.ExpireAsync());
                Console.WriteLine($"Expired Advertisement:\n{JsonConvert.SerializeObject(advertisementResource, Formatting.Indented)}");
            }
            catch (RequestException ex)
            {
                LogException(ex);
            }

            return advertisementResource;
        }