Exemplo n.º 1
0
        public void TransferOffersTest()
        {
            using (var context = MockContext.Start(this.GetType()))
            {
                using (var client = context.GetServiceClient <MarketplaceRPServiceClient>())
                {
                    SetUp(client);
                    // Create offer in the Test collection
                    var offerToUpdate = new Offer
                    {
                        ETag = "57002de5-0000-0300-0000-5eaee7e50000",
                        SpecificPlanIdsLimitation = new List <string> {
                            planId
                        }
                    };
                    var createCollectionOffer = client.PrivateStoreCollectionOffer.CreateOrUpdate(PrivateStoreId, offerId, collectionId, offerToUpdate);

                    // Transfer offer to target collection
                    TransferOffersProperties transferOffersProperties = new TransferOffersProperties
                    {
                        TargetCollections = new List <string>()
                        {
                            TargetcollectionId
                        },
                        Operation    = "copy",
                        OfferIdsList = new List <string>()
                        {
                            offerId
                        }
                    };
                    var transferOffersOperation = client.PrivateStoreCollection.TransferOffers(PrivateStoreId, collectionId, transferOffersProperties);

                    var transsferedOffer = client.PrivateStoreCollectionOffer.Get(PrivateStoreId, offerId, TargetcollectionId);
                    Assert.Equal(transsferedOffer.UniqueOfferId, offerId);

                    CleanUp(client);
                }
            }
        }
 /// <summary>
 /// transferring offers (copy or move) from source collection to target
 /// collection(s)
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='privateStoreId'>
 /// The store ID - must use the tenant ID
 /// </param>
 /// <param name='collectionId'>
 /// The collection ID
 /// </param>
 /// <param name='payload'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <TransferOffersResponse> TransferOffersAsync(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, TransferOffersProperties payload = default(TransferOffersProperties), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.TransferOffersWithHttpMessagesAsync(privateStoreId, collectionId, payload, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// transferring offers (copy or move) from source collection to target
 /// collection(s)
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='privateStoreId'>
 /// The store ID - must use the tenant ID
 /// </param>
 /// <param name='collectionId'>
 /// The collection ID
 /// </param>
 /// <param name='payload'>
 /// </param>
 public static TransferOffersResponse TransferOffers(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, TransferOffersProperties payload = default(TransferOffersProperties))
 {
     return(operations.TransferOffersAsync(privateStoreId, collectionId, payload).GetAwaiter().GetResult());
 }