private IEnumerable<AppCategories> MakeCollectionCategories()
        {
            AppCategories cats = new AppCategories
            {
                Scheme = new Uri("http://TestScheme.com"),
                Fixed = false,
            };

            // add two categories
            cats.Categories = new List<AtomSite.Domain.AtomCategory>
                {
                    TestDataHelper.MakeTestCategory(), TestDataHelper.MakeTestCategory()
                };

            return cats.InList();
        }
        public void UpdateAppServiceAddCategoryTest()
        {
            IAppServiceRepository repository = GetRepository();

            AppService appService = repository.GetService();

            Assert.IsNotNull(appService, "no app service");
            Assert.IsNotNull(appService.Workspaces);

            // put a new workspace in it
            AtomSite.Domain.AppWorkspace newWorkspace = TestDataHelper.MakeTestWorkspace();
            string workspaceName = newWorkspace.Name;

            // containing a collection
            AtomSite.Domain.AppCollection newCollection = TestDataHelper.MakeTestAppCollection();
            string collectionTitle = newCollection.Title.Text;

            // containing an app category
            AtomSite.Domain.AppCategories newCats = new AppCategories
            {
                Scheme = new Uri("http://www.foo.com"),
                Base = new Uri("http://www.base.com"),
                Fixed = true
            };

            // containing a category
            AtomSite.Domain.AtomCategory newAtomCat = new AtomSite.Domain.AtomCategory
                {
                    Base = new Uri("http://www.base.com"),
                    Label = Guid.NewGuid().ToString(),
                    Term = Guid.NewGuid().ToString(),
                    Lang = "EN",
                    Scheme = new Uri("http://www.foo.com")
                };

            newCats.Categories = newAtomCat.InList();

            newCollection.Categories = newCats.InList();
            newWorkspace.Collections = newCollection.InList();
            appService.Workspaces = appService.Workspaces.Add(newWorkspace);

            // persist it
            repository.UpdateService(appService);

            // and reload, check the collection
            // to verify that the data was saved and loaded

            IAppServiceRepository secondRepository = GetRepository();

            AppService loadedAppService = secondRepository.GetService();
            Assert.IsNotNull(loadedAppService);

            AppCollection loadedCollection = loadedAppService.Workspaces.FindByName(workspaceName).Collections.FindByTitle(collectionTitle);

            Assert.IsNotNull(loadedCollection);
            Assert.AreEqual(1, loadedCollection.Categories.Count());

            AppCategories loadedCats = loadedCollection.Categories.First();

            Assert.AreEqual(1, loadedCats.Categories.Count(), "Atom category not found");
            AtomSite.Domain.AtomCategory loadedAtomCat = loadedCats.Categories.First();

            DataTester.AssertCategoriesEqual(newAtomCat, loadedAtomCat);

            // delete the workspaces
            DeleteWorkspace(secondRepository, workspaceName);
        }