public void AddStyleToStyleClass_AlreadyExists_Ok()
        {
            StyleClass styleClass    = Utils.CreateStyleClassForTest();
            int        originalCount = styleClass.ProperStyles.Count;
            Style      style         = Utils.CreateStyleForTest();

            style.Name = "newStyle";
            styleClass.AddStyle(style);
            styleClass.AddStyle(style);
            Assert.IsTrue(styleClass.ProperStyles.Count == (originalCount + 1));
        }
Exemple #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 AddStyleToStyleClass_ExpectedParameters_Ok()
        {
            StyleClass styleClass = Utils.CreateStyleClassForTest();
            Style      style      = Utils.CreateStyleForTest();

            styleClass.AddStyle(style);
            Assert.IsTrue(styleClass.ProperStyles.Contains(style));
        }
        public void RemoveStyleFromStyleClass_ExpectedParameters_Ok()
        {
            StyleClass styleClass = Utils.CreateStyleClassForTest();
            Style      style      = Utils.CreateStyleForTest();

            styleClass.AddStyle(style);
            styleClass.RemoveStyle(style);
            Assert.IsFalse(styleClass.ProperStyles.Contains(style));
        }
        public void TryObserver_ExpectedParam_Ok()
        {
            StyleClass    inheritStyleClass = Utils.CreateStyleClassForTest();
            Style         colorRed          = Utils.CreateStyleForTest("color red", Style.StyleType.COLOR, "red");
            IList <Style> styleList         = new List <Style>();

            styleList.Add(colorRed);
            StyleClass newStyleClass = new StyleClass("name", styleList, inheritStyleClass);


            Style alignRight = Utils.CreateStyleForTest("align right", Style.StyleType.ALIGN, "right");

            inheritStyleClass.AddStyle(alignRight);
            Assert.IsTrue(newStyleClass.InheritedPlusProperStyles.Count == 2);
        }
Exemple #6
0
 public void AddStyle(Guid styleClassId, Style style)
 {
     if (Exists(styleClassId))
     {
         if (StyleBusinessLogic.Exists(style.Name))
         {
             StyleClass styleClass = StyleClassDataAccess.Get(styleClassId);
             styleClass.AddStyle(style);
             StyleClassDataAccess.Modify(styleClass);
         }
         else
         {
             throw new ArgumentException("Style doesn't exist " + style.Name);
         }
     }
     else
     {
         throw new ArgumentException("StyleClass doesn't exist " + styleClassId);
     }
 }