public void AddStyleClassToFormat_AlreadyExists_Ok()
        {
            Format     format        = CreateFormatForTest();
            int        originalCount = format.StyleClasses.Count;
            StyleClass styleClass    = Utils.CreateStyleClassForTest();

            format.AddStyleClass(styleClass);
            format.AddStyleClass(styleClass);

            Assert.IsTrue(format.StyleClasses.Count == originalCount + 1);
        }
예제 #2
0
        public void GenerateHTML_StyleClasInFormatOnlyOneText_Ok()
        {
            IGenerator htmlGenerator = new HtmlGenerator();
            Style      colorRed      = Utils.CreateStyleForTest("color red", Style.StyleType.COLOR, "red");
            Style      colorBlue     = Utils.CreateStyleForTest("color blue", Style.StyleType.COLOR, "blue");
            Style      alignRight    = Utils.CreateStyleForTest("align right", Style.StyleType.ALIGN, "right");
            Style      bold          = Utils.CreateStyleForTest("bold", Style.StyleType.BOLD, "bold");
            Style      italic        = Utils.CreateStyleForTest("italic", Style.StyleType.ITALIC, "italic");
            StyleClass styleClassInheritedParagraph = CreateStyleClassForTest("Normal0", alignRight);
            StyleClass styleClassParagraph          = CreateStyleClassForTest("Normal", colorBlue);
            StyleClass styleClassDocument           = CreateStyleClassForTest("Normal2", bold);

            styleClassParagraph.SetInheritedStyleClass(styleClassInheritedParagraph);
            styleClassInheritedParagraph.AddStyle(italic);

            Format format = CreateFormatForTest(styleClassParagraph);

            format.AddStyleClass(styleClassDocument);

            Document  document  = Utils.CreateDocumentForTest();
            Paragraph paragraph = Utils.CreateParagraphForTest();
            Text      text      = Utils.CreateTextForTest();

            paragraph.PutTextAtLast(text);
            document.DocumentParagraphs.Add(paragraph);

            document.OwnStyleClass  = "Normal";
            paragraph.OwnStyleClass = "Normal2";

            string htmlGenerated = htmlGenerator.Generate(document, format);
            int    x             = 2;
        }
        public void AddStyleClassToFormat_ExpectedParameters_Ok()
        {
            StyleClass styleClass = Utils.CreateStyleClassForTest();
            Format     format     = CreateFormatForTest();

            format.AddStyleClass(styleClass);
            Assert.IsTrue(format.StyleClasses.Contains(styleClass));
        }
예제 #4
0
 public void AddStyle(Guid formatId, StyleClass styleClass)
 {
     if (Exists(formatId))
     {
         if (StyleClassBusinessLogic.Exists(styleClass.Id))
         {
             Format format = FormatDataAccess.Get(formatId);
             format.AddStyleClass(styleClass);
             FormatDataAccess.Modify(format);
         }
         else
         {
             throw new ArgumentException("StyleClass doesn't exist styleClass.Name");
         }
     }
     else
     {
         throw new ArgumentException("StyleClass doesn't exist styleClass.Name");
     }
 }