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"); }
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); }
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"); }
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; }
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"); }