// Upserts collections to privateStore private void SetUp(MarketplaceRPServiceClient client) { // Check privateStore exist var privateStore = client.PrivateStore.Get(PrivateStoreId); Assert.NotNull(privateStore); // Clean test collection if exist try { client.PrivateStoreCollection.Delete(PrivateStoreId, collectionId); } catch (Exception ex) { if (!ex.Message.Contains("NotFound")) { throw; } } try { client.PrivateStoreCollection.Delete(PrivateStoreId, TargetcollectionId); } catch (Exception ex) { if (!ex.Message.Contains("NotFound")) { throw; } } // Create Test Collections Collection testCollection = new Collection { CollectionName = TestCollectionName, AllSubscriptions = false, SubscriptionsList = new List <string> { testSubscription } }; Collection targetTestCollection = new Collection { CollectionName = TargetTestCollectionName, AllSubscriptions = false, SubscriptionsList = new List <string> { testSubscription } }; client.PrivateStoreCollection.CreateOrUpdate(PrivateStoreId, collectionId, testCollection); client.PrivateStoreCollection.CreateOrUpdate(PrivateStoreId, TargetcollectionId, targetTestCollection); }
// Delete collections from private store private void CleanUp(MarketplaceRPServiceClient client) { // Deleting test collections client.PrivateStoreCollection.Delete(PrivateStoreId, collectionId); client.PrivateStoreCollection.Delete(PrivateStoreId, TargetcollectionId); }