コード例 #1
0
        public CollectionNameNotValidException GetContentAreasForNameWithValidApiKey()
        {
            try
            {
                CollectionResource collectionResource = new Api().Resource<CollectionResource>();
                var newCollection = collectionResource.NewCollection();

                var applicationId = newCollection.ApplicationId;
                var application = _applicationsServiceAgent.Get(applicationId);

                var apiKey = application.ApiKey;
                var collectionNameThatDoesNotExist = newCollection.Name + "NowDoesNotExist";

                _contentAreasServiceAgent.GetByCollectionNameAndApiKey(apiKey, collectionNameThatDoesNotExist);
            }
            catch (CollectionNameNotValidException ex)
            {
                return ex;
            }

            throw new SpecFlowException("Expected CollectionNameNotValidException was not caught");
        }
コード例 #2
0
        public IEnumerable<ContentArea> GetContentAreasForValidApiKeyAndCollectionName()
        {
            CollectionResource collectionResource = new Api().Resource<CollectionResource>();
            var newCollection = collectionResource.NewCollection();

            var applicationId = newCollection.ApplicationId;
            var application = _applicationsServiceAgent.Get(applicationId);

            var apiKey = application.ApiKey;
            var collectionName = newCollection.Name;

            _contentAreasServiceAgent.Post(
                     new ContentArea
                     {
                         Active = true,
                         Name = "name",
                         ApplicationId = applicationId,
                         Content = "testContentArea",
                         ContentType = ContentAreaType.HtmlArea,
                         CollectionId = newCollection.Id
                     });

            return _contentAreasServiceAgent.GetByCollectionNameAndApiKey(apiKey, collectionName);
        }
コード例 #3
0
        public CollectionIdNotPartOfApplicationException NewContentAreaWithInvalidApplicationId()
        {
            try
            {
                CollectionResource collectionResource = new Api().Resource<CollectionResource>();
                var newCollection = collectionResource.NewCollection();
                var collectionId = newCollection.Id;
                var applicationId = newCollection.ApplicationId;

                _contentAreasServiceAgent.Post(
                    new ContentArea
                        {
                            Active = true,
                            Name = "name",
                            ApplicationId = applicationId + "partToMakeApplicationIdDifferent",
                            Content = "testContentArea",
                            ContentType = ContentAreaType.HtmlArea,
                            CollectionId = collectionId
                        });
            }
            catch (CollectionIdNotPartOfApplicationException ex)
            {
                return ex;
            }
            throw new SpecFlowException("Expected CollectionIdNotPartOfApplicationException was not caught");
        }
コード例 #4
0
        public ContentArea NewContentAreaWithSpecifiedName(string name)
        {
            CollectionResource collectionResource = new Api().Resource<CollectionResource>();
            var newCollection = collectionResource.NewCollection();
            var collectionId = newCollection.Id;
            var applicationId = newCollection.ApplicationId;

            ContentArea response =
                _contentAreasServiceAgent.Post(
                    new ContentArea
                    {
                        Active = true,
                        Name = name,
                        ApplicationId = applicationId,
                        Content = "testContentArea",
                        ContentType = ContentAreaType.HtmlArea,
                        CollectionId = collectionId
                    });

            return response;
        }
コード例 #5
0
        public ContentAreaNameAlreadyExistsInCollectionException NewContentAreaWithExistingName()
        {
            try
            {
                CollectionResource collectionResource = new Api().Resource<CollectionResource>();
                var newCollection = collectionResource.NewCollection();
                var collectionId = newCollection.Id;
                var applicationId = newCollection.ApplicationId;

                _contentAreasServiceAgent.Post(
                    new ContentArea
                    {
                        Active = true,
                        Name = "sameName",
                        ApplicationId = applicationId,
                        Content = "testContentArea",
                        ContentType = ContentAreaType.HtmlArea,
                        CollectionId = collectionId
                    });

                _contentAreasServiceAgent.Post(
                    new ContentArea
                    {
                        Active = true,
                        Name = "sameName",
                        ApplicationId = applicationId,
                        Content = "testContentArea",
                        ContentType = ContentAreaType.Label,
                        CollectionId = collectionId
                    });
            }
            catch (ContentAreaNameAlreadyExistsInCollectionException ex)
            {
                return ex;
            }

            throw new SpecFlowException("Expected ContentAreaNameAlreadyExistsInCollectionException was not caught");
        }