public void TestBrokenRelatedLinks()
        {
            PivotCollection collection = new PivotCollection();
            collection.FacetCategories.Add(new PivotFacetCategory("alpha", PivotFacetType.String));

            PivotItem item = new PivotItem("0", collection);
            item.AddFacetValues("alpha", "alpha");
            item.AddRelatedLink(new PivotLink(null, "http://pauthor.codeplex.com"));
            collection.Items.Add(item);

            item = new PivotItem("1", collection);
            item.AddFacetValues("alpha", "bravo");
            item.AddRelatedLink(new PivotLink("charlie", null));
            collection.Items.Add(item);

            PivotCollectionBuffer buffer = new PivotCollectionBuffer(collection);
            String targetPath = Path.Combine(WorkingDirectory, "sample.cxml");
            LocalCxmlCollectionTarget target = new LocalCxmlCollectionTarget(targetPath);
            target.Write(buffer);

            AssertCxmlSchemaValid(targetPath);

            CxmlCollectionSource targetAsSource = new CxmlCollectionSource(targetPath);
            buffer.Write(targetAsSource);

            AssertEqual("Related Link", buffer.Collection.Items[0].RelatedLinks.First().Title);
            AssertEqual("http://pauthor.codeplex.com", buffer.Collection.Items[0].RelatedLinks.First().Url);
            AssertEqual(0, buffer.Collection.Items[1].RelatedLinks.Count());
        }
        public void TestRoundTrip()
        {
            String sourcePath = Path.Combine(this.ResourceDirectory, @"DeepZoom\sample.cxml");
            String targetPath = Path.Combine(WorkingDirectory, "sample.cxml");

            CxmlCollectionSource source = new CxmlCollectionSource(sourcePath);
            LocalCxmlCollectionTarget target = new LocalCxmlCollectionTarget(targetPath);
            CxmlCollectionSource targetAsSource = new CxmlCollectionSource(targetPath);

            target.Write(source);

            AssertCxmlSchemaValid(targetPath);
            AssertCollectionsEqual(source, targetAsSource);
        }
示例#3
0
        public static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                System.Console.WriteLine("USAGE: RSS Crawler.exe <RSS feed> <output CXML>");
                return;
            }

            RssCollectionSource source = new RssCollectionSource(args[0]);
            HtmlImageCreationSourceFilter sourceFilter1 = new HtmlImageCreationSourceFilter(source);
            sourceFilter1.HtmlTemplate = "<html><body><h1>{name}</h1>{description}" +
                "<p style=\"position:absolute;bottom:10px;left:10px\">{category:join:, }</p></body></html>";
            sourceFilter1.Width = 600;
            sourceFilter1.Height = 600;

            LocalCxmlCollectionTarget target = new LocalCxmlCollectionTarget(args[1]);
            DeepZoomTargetFilter targetFilter1 = new DeepZoomTargetFilter(target);

            targetFilter1.Write(sourceFilter1);
        }