public void CanWriteContentWithCategory()
        {
            content = new AdmContent();
            content.AddCategory(new AdmCategory("category"));

            content.Write(writer);
        }
示例#2
0
        /// <summary>
        /// Ends the current category.
        /// </summary>
        /// <remarks>
        /// If the current category has a parent category, the parent category is made the current category.
        /// </remarks>
        /// <exception cref="InvalidOperationException">when there is no current category.</exception>
        /// <exception cref="InvalidOperationException">when there is an unfinished policy being built.</exception>
        public void EndCategory()
        {
            CheckCurrentCategory();
            CheckNoStartedPolicy();

            AdmCategory currentCategory = categoriesStack.Pop();

            if (categoriesStack.Count == 0)
            {
                content.AddCategory(currentCategory);
            }
            else
            {
                categoriesStack.Peek().AddCategory(currentCategory);
            }
        }