Пример #1
0
        public void constructor_should_set_elements_to_empty()
        {
            // When
            SUT = new Subsubsection();

            // Then
            Assert.IsEmpty(SUT.Elements);
        }
        public void setChildElement_should_throw_if_there_is_no_children_set()
        {
            // Given
            var subsubsection = new Subsubsection();

            // Then
            var ex = Assert.Throws <ArgumentException>(() => SUT.SetChildElement(subsubsection));

            Assert.AreEqual("No child elements supplied to set as child", ex.Message);
        }
        /// <summary>
        /// Parses the code given the object and sets the data to the object
        /// from the front of the string.
        /// </summary>
        /// <param name="code">The code to parse and handle</param>
        /// <returns>
        /// The newly parsed object. The string builder will also have been updted, the code parsed is removed
        /// </returns>
        /// <exception cref="ArgumentException">Thrown if the code string doesn't start with one of the accepted code indicators or the element isn't supported by the parser</exception>
        public LaTeXElement ParseCode(StringBuilder code)
        {
            var chapter = new Subsubsection();

            if (!Regex.IsMatch(code.ToString(), CodeParser.CreateCodeStartPattern(CodeIndicators)))
            {
                throw new ArgumentException("The code didn't start with an allowed indicator");
            }

            chapter.Name = CodeParser.SimpleContent("subsubsection", code);
            return(chapter);
        }
        public void setChildElement_should_set_elemnts()
        {
            // Given
            var text1         = new TextBody();
            var text2         = new TextBody();
            var subsubsection = new Subsubsection();

            // When
            SUT.SetChildElement(subsubsection, text1, text2);

            // Then
            Assert.AreSame(text1, subsubsection.Elements[0]);
            Assert.AreSame(text2, subsubsection.Elements[1]);
        }
Пример #5
0
 public void Teardown()
 {
     SUT = null;
 }
Пример #6
0
 public void Setup()
 {
     SUT = new Subsubsection();
 }