public void SubscribeTargetToSourceChanges(CloudBlob subscriber)
 {
     if (subscriber.CanContainExternalMetadata() == false)
     {
         throw new InvalidDataException("Subscriber candidate cannot contain metadata: " + subscriber.Name);
     }
     foreach (var source in CollectionContent.Where(src => src.IsInformationObjectSource))
     {
         SubscribeSupport.AddSubscriptionToObject(source.SourceLocation, subscriber.Name,
                                                  SubscribeSupport.SubscribeType_WebPageToSource);
     }
 }
        public void SetDefaultSource(InformationSource defaultSource)
        {
            InformationSource currentDefaultSource = GetDefaultSource(defaultSource.SourceInformationObjectType);

            if (currentDefaultSource != null)
            {
                CollectionContent.Remove(currentDefaultSource);
            }
            CollectionContent.Add(defaultSource);
            currentDefaultSource = GetDefaultSource(defaultSource.SourceInformationObjectType);
            if (defaultSource != currentDefaultSource)
            {
                throw new InvalidDataException("Invalid default source given to add (not maching the GetDefaultSource conditions)");
            }
        }
        private CollectionContentModel CreateCollectionModel(string collectionName = null, string id = null, string method = null, string requestName = null)
        {
            var header = new List <Header>
            {
                new Header {
                    key = "X-Api-Key", value = Key.key
                },
                new Header {
                    key = "Content-Type", value = "application/json"
                }
            };

            var url = new Url
            {
                raw      = Constants.baseUri,
                protocol = "https",
                host     = new List <string>
                {
                    "api",
                    "getpostman",
                    "com"
                },
                path = new List <string>
                {
                    "collections"
                }
            };

            var request = new Request
            {
                url    = url,
                method = method ?? "GET",
                header = header
            };

            var item = new List <Item>
            {
                new Item
                {
                    name    = requestName ?? "Test",
                    request = request
                }
            };

            var info = new Info
            {
                _postman_id = id ?? Guid.NewGuid().ToString(),
                name        = collectionName ?? "vsTest",
                schema      = Constants.CollectionSchema
            };

            var collection = new CollectionContent
            {
                info = info,
                item = item
            };

            return(new CollectionContentModel {
                collection = collection
            });
        }
 public bool HasAnySourceChanged()
 {
     return(CollectionContent.Any(source => source.HasSourceChanged()));
 }
 public InformationSource GetDefaultSource(string informationObjectTypeName)
 {
     return
         (CollectionContent.FirstOrDefault(
              source => source.IsInformationObjectSource && String.IsNullOrEmpty(source.SourceName) && source.SourceInformationObjectType == informationObjectTypeName));
 }
 public IInformationObject[] FetchAllInformationObjects()
 {
     return(CollectionContent.Where(source => source.IsInformationObjectSource).Select(
                source => source.RetrieveInformationObject()).ToArray());
 }