예제 #1
0
 public void EclBasicSearch()
 {
     var hostServices = new Mock.HostServicesMockup();
     var provider = GetFotoWareProvider();
     var context = GetContext(provider);
     var searchTerm = string.Format(
         "({0} contains ({1}))",
         API.SearchFields.Metadata.Brand,
         "Lindex"
     );
     var rootUri = hostServices.CreateEclUri(
         publicationId: PublicationId,
         mountPointId: MountpountId,
         itemId: "root",
         subType: "mp",
         itemType: EclItemTypes.MountPoint
     );
     var results = context.Search(rootUri, searchTerm, 0, 25);
 }
예제 #2
0
        private FotoWareProvider GetFotoWareProvider()
        {
            IHostServices hostServices = new Mock.HostServicesMockup();
            string configXML = Properties.Resources.ExternalContentLibrary_FotoWare;
            string moutpointId = "UnitTestID";

            FotoWareProvider provider = new FotoWareProvider();
            provider.Initialize(moutpointId, configXML, hostServices);
            return provider;
        }
예제 #3
0
        public void EclGetRootFolders()
        {
            IHostServices hostservices = new Mock.HostServicesMockup();
            var provider = new FotoWareProvider();
            var context = GetContext(provider);

            IEclUri rootUri = hostservices.CreateEclUri(126, "fwx", "root", "mp", EclItemTypes.MountPoint);
            context.GetFolderContent(rootUri, 0, EclItemTypes.Folder);
        }
예제 #4
0
 private IContentLibraryContext GetContext(IContentLibrary provider)
 {
     IHostServices services = new Mock.HostServicesMockup();
     ITridionUser user = new Mock.TridionUserMockup()
     {
         FullName = "Unit Test",
         UserName = "******",
         Id = "tcm:0-1-65536",
         IsAdministrator = true,
         IsTrustedReadOnlyMode = true
     };
     IEclSession session = new Mock.EclSessionMockup(services, user);
     var context = provider.CreateContext(session);
     return context;
 }
예제 #5
0
        public void EclGetItem()
        {
            var hostServices = new Mock.HostServicesMockup();
            var provider = GetFotoWareProvider();
            var context = GetContext(provider);

            // ecl:117-fwx-E9FDDEFC6D0B45E0_B6B5D9E227D8D432-asset-file
            string uniqueId = "E9FDDEFC6D0B45E0_B6B5D9E227D8D432";
            var summerDressURI = hostServices.CreateEclUri(
                publicationId: 117,
                mountPointId: MountpountId,
                itemId: uniqueId,
                subType: Model.Asset.DisplayTypeIdentifier,
                itemType: EclItemTypes.File
            );

            var dress = context.GetItem(summerDressURI);

            Assert.IsNotNull(dress, "Failed to retrieve asset by unique document id: " + uniqueId);
            Assert.IsNotNull(dress.Id);
            Assert.AreEqual(dress.Id.ItemId, uniqueId);
            Assert.AreEqual(dress.Title, "S0000007401168_PS_B.jpg");

            var previewUrl = ((IContentLibraryMultimediaItem)dress).GetDirectLinkToPublished(null);
        }