/// <summary>
 /// This test will fail if the default values are changed
 /// </summary>
 public void TestDetermineSizeNotDefined()
 {
     int width = 0, height = 0;
     HtmlImageCreator creator = new HtmlImageCreator();
     creator.ReadSizeFromTemplate("<html>{name}</html>", ref width, ref height);
     AssertEqual(0, width);
     AssertEqual(0, height);
 }
 public void TestDetermineSizeWithInvalidValue()
 {
     int width = 1000, height = 2000;
     HtmlImageCreator creator = new HtmlImageCreator();
     creator.ReadSizeFromTemplate("<!-- size: one hundred, 200 --><html>{name}</html>", ref width, ref height);
     AssertEqual(1000, width);
     AssertEqual(2000, height);
 }
 public void TestDetermineSizeMixedCase()
 {
     int width = 1000, height = 2000;
     HtmlImageCreator creator = new HtmlImageCreator();
     creator.ReadSizeFromTemplate("<!-- SiZe: 100, 200 --><html>{name}</html>", ref width, ref height);
     AssertEqual(100, width);
     AssertEqual(200, height);
 }
 /// <summary>
 /// Creates an HTML image creation source filter with a given collection source delegate.
 /// </summary>
 /// <param name="source">the collection source from which this filter's data will be drawn</param>
 public HtmlImageCreationSourceFilter(IPivotCollectionSource source)
     : base(source)
 {
     m_imageCreator = new HtmlImageCreator();
 }
 /// <summary>
 /// Disposes of resources used by this source filter.
 /// </summary>
 public override void Dispose()
 {
     if (m_imageCreator != null)
     {
         m_imageCreator.Dispose();
         m_imageCreator = null;
     }
 }
        public void TestSimpleTemplateWithStandardElements()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{name};{href};{description}</body></html>";

            String html = creator.InstantiateTemplate(sampleItem1);
            AssertEqual("<html><body>Delta;http://www.delta.com;delta delta delta delta</body></html>", html);
        }
 public void TestDetermineSizeWithOddWhitespace()
 {
     int width = 1000, height = 2000;
     HtmlImageCreator creator = new HtmlImageCreator();
     creator.ReadSizeFromTemplate("<!--     size:\n\n\t100,200\t--><html>{name}</html>", ref width, ref height);
     AssertEqual(100, width);
     AssertEqual(200, height);
 }
        public void TestTemplateWithMultipleOccurancesOfStandardElements()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{name};{name};{name};{name}</body></html>";

            String html = creator.InstantiateTemplate(sampleItem1);
            AssertEqual("<html><body>Delta;Delta;Delta;Delta</body></html>", html);
        }
        public void TestTemplateWithMixedCaseJoinTags()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{subject:join:, };{Subject:Join:, };" +
                "{SUBJECT:JOIN:, };{sUbJeCt:JoIn:, }</body></html>";

            String html = creator.InstantiateTemplate(sampleItem1);
            AssertEqual("<html><body>Woman, Jewelry;Woman, Jewelry;" +
                "Woman, Jewelry;Woman, Jewelry</body></html>", html);
        }
        public void TestTemplateWithMixedStandardElementsAndSingleValueFacets()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{name};{letters}</body></html>";

            String html = creator.InstantiateTemplate(sampleItem1);
            AssertEqual("<html><body>Delta;5</body></html>", html);
        }
        public void TestTemplateWithMixedCaseFacets()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{letters};{Letters};{LETTERS};{LeTtErS}</body></html>";

            String html = creator.InstantiateTemplate(sampleItem1);
            AssertEqual("<html><body>5;5;5;5</body></html>", html);
        }
        public void TestTemplateWithJoinTagSingleValue()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{letters:join:, }</body></html>";

            String html = creator.InstantiateTemplate(sampleItem1);
            AssertEqual("<html><body>5</body></html>", html);
        }
        public void TestTemplateWithJoinTagMultipleValues()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{subject:join:, }</body></html>";

            String html = creator.InstantiateTemplate(sampleItem2);
            AssertEqual("<html><body>Earth, Sky, Water, Explosion</body></html>", html);
        }
        public void TestTemplateWithIndexedTagsOutOfRange()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{subject:0};{subject:1};{subject:2};{subject:3}</body></html>";

            String html = creator.InstantiateTemplate(sampleItem1);
            AssertEqual("<html><body>Woman;Jewelry;;</body></html>", html);
        }
        public void TestTemplateWithFacetNamesWithSpaces()
        {
            HtmlImageCreator creator = new HtmlImageCreator();
            creator.HtmlTemplate = "<html><body>{launch date}</body></html>";

            String html = creator.InstantiateTemplate(sampleItem1);
            AssertEqual("<html><body>2003-10-03T20:35:00</body></html>", html);
        }