public new virtual void SetUp()
 {
     base.SetUp();
     const string Alreadyexists = "alreadyExists";
     var contentArea = new ContentArea { Name = Alreadyexists, CollectionId = collectionId };
     ContentAreaRepository.Stub(x => x.ContentAreasInCollection(collectionId)).Return(new List<ContentArea> { new ContentArea { CollectionId = collectionId, Name = Alreadyexists } });
     try
     {
         ContentAreaService.Create(contentArea);
     }
     catch (ContentAreaNameAlreadyExistsInCollectionException ex)
     {
         exception = ex;
     }
 }
        public BadRequestException UpdateContentAreaWithUnspecifiedName(ContentArea contentArea)
        {
            try
            {
                contentArea.Name = string.Empty;
                _contentAreasServiceAgent.Put(contentArea);
            }
            catch (BadRequestException ex)
            {
                return ex;
            }

            throw new SpecFlowException("Expected Bad Request Exception not caught");
        }
 public ContentArea UpdateContentArea(ContentArea contentArea)
 {
     return _contentAreasServiceAgent.Put(contentArea);
 }
            public new virtual void SetUp()
            {
                base.SetUp();
                var contentArea = new ContentArea { Name = "test", CollectionId = CollectionIdThatIsNotPartOfApplication };
                ContentAreaRepository.Stub(x => x.ContentAreasInCollection(CollectionIdThatIsNotPartOfApplication))
                    .Return(new List<ContentArea>());
                CollectionService.Stub(x => x.GetById(CollectionIdThatIsNotPartOfApplication))
                                 .Return(new Collection { Id = CollectionIdThatIsNotPartOfApplication, ApplicationId = ApplicationIdThatDoesNotHaveCollectionId });

                try
                {
                    ContentAreaService.Create(contentArea);
                }
                catch (CollectionIdNotPartOfApplicationException ex)
                {
                    exception = ex;
                }
            }
            public new virtual void SetUp()
            {
                ContentArea contentAreaToCreate = new ContentArea();
                ContentAreaService.Stub(x => x.Create(contentAreaToCreate))
                                  .Throw(new ContentAreaNameAlreadyExistsInCollectionException());

                try
                {
                    ContentAreaController.Post(contentAreaToCreate);
                }
                catch (HttpResponseException ex)
                {
                    exception = ex;
                }
            }
        public ContentArea Put(ContentArea contentArea)
        {
            HttpRequestMessage request = CreatePutRequest(contentArea, "/contentArea/");

            return CheckResult<ContentArea>(request);
        }