예제 #1
0
        public void TestBinaryContentFolder()
        {
            MediaFolderProvider repository = new MediaFolderProvider();

            var folderName = "Images";
            var folder     = new MediaFolder(contentRepository, folderName)
            {
                AllowedExtensions = new[] { ".jpg", ".png" }
            };

            repository.Add(folder);

            var all = repository.All(contentRepository);

            Assert.AreEqual(1, all.Count());

            var item = (MediaFolder)repository.Get(all.First());

            Assert.AreEqual(folder.Name, item.Name);
            Assert.AreEqual(folder.DisplayName, item.DisplayName);
            Assert.AreEqual(folder.Repository, item.Repository);
            Assert.AreEqual(folder.AllowedExtensions.Count(), item.AllowedExtensions.Count());

            //   repository.Remove(item);
        }
예제 #2
0
        public void Register(IContainerManager containerManager, ITypeFinder typeFinder)
        {
            //
            var mediaFolderProvider = new MediaFolderProvider(containerManager.Resolve<IMediaFolderProvider>());
            containerManager.AddComponentInstance(typeof(IMediaFolderProvider), mediaFolderProvider);
            containerManager.AddComponentInstance(typeof(IProvider<MediaFolder>), mediaFolderProvider);

            var repositoryProvider = new RepositoryProvider(containerManager.Resolve<IRepositoryProvider>());
            containerManager.AddComponentInstance(typeof(IRepositoryProvider), repositoryProvider);
            containerManager.AddComponentInstance(typeof(IProvider<Repository>), repositoryProvider);

            var schemaProvider = new SchemaProvider(containerManager.Resolve<ISchemaProvider>());
            containerManager.AddComponentInstance(typeof(ISchemaProvider), schemaProvider);
            containerManager.AddComponentInstance(typeof(IProvider<Schema>), schemaProvider);

            var textFolderProvider = new TextFolderProvider(containerManager.Resolve<ITextFolderProvider>());
            containerManager.AddComponentInstance(typeof(ITextFolderProvider), textFolderProvider);
            containerManager.AddComponentInstance(typeof(IProvider<TextFolder>), textFolderProvider);
        }
예제 #3
0
        public void TestBinaryContentFolder()
        {
            MediaFolderProvider repository = new MediaFolderProvider();

            var folderName = "Images";
            var folder = new MediaFolder(contentRepository, folderName) { AllowedExtensions = new[] { ".jpg", ".png" } };

            repository.Add(folder);

            var all = repository.All(contentRepository);

            Assert.AreEqual(1, all.Count());

            var item = (MediaFolder)repository.Get(all.First());

            Assert.AreEqual(folder.Name, item.Name);
            Assert.AreEqual(folder.DisplayName, item.DisplayName);
            Assert.AreEqual(folder.Repository, item.Repository);
            Assert.AreEqual(folder.AllowedExtensions.Count(), item.AllowedExtensions.Count());

             //   repository.Remove(item);
        }