1 #ifndef CPPUNITEST_XMLELEMENTTEST_H
2 #define CPPUNITEST_XMLELEMENTTEST_H
3 
4 #include <cppunit/extensions/HelperMacros.h>
5 #include <stdexcept>
6 
7 
8 /*! Unit tests for XmlElement.
9  */
10 class XmlElementTest : public CPPUNIT_NS::TestFixture
11 {
12   CPPUNIT_TEST_SUITE( XmlElementTest );
13   CPPUNIT_TEST( testStringContentConstructor );
14   CPPUNIT_TEST( testNumericContentConstructor );
15   CPPUNIT_TEST( testSetName );
16   CPPUNIT_TEST( testSetStringContent );
17   CPPUNIT_TEST( testSetNumericContent );
18   CPPUNIT_TEST( testElementCount );
19   CPPUNIT_TEST_EXCEPTION( testElementAtNegativeIndexThrow, std::invalid_argument );
20   CPPUNIT_TEST_EXCEPTION( testElementAtTooLargeIndexThrow, std::invalid_argument );
21   CPPUNIT_TEST( testElementAt );
22   CPPUNIT_TEST_EXCEPTION( testElementForThrow, std::invalid_argument );
23   CPPUNIT_TEST( testElementFor );
24 
25   CPPUNIT_TEST( testEmptyNodeToString );
26   CPPUNIT_TEST( testElementWithAttributesToString );
27   CPPUNIT_TEST( testEscapedAttributeValueToString );
28   CPPUNIT_TEST( testElementToStringEscapeContent );
29   CPPUNIT_TEST( testElementWithChildrenToString );
30   CPPUNIT_TEST( testElementWithContentToString );
31   CPPUNIT_TEST( testElementWithNumericContentToString );
32   CPPUNIT_TEST( testElementWithContentAndChildToString );
33   CPPUNIT_TEST_SUITE_END();
34 
35 public:
36   /*! Constructs a XmlElementTest object.
37    */
38   XmlElementTest();
39 
40   /// Destructor.
41   virtual ~XmlElementTest();
42 
43   void setUp();
44   void tearDown();
45 
46   void testStringContentConstructor();
47   void testNumericContentConstructor();
48   void testSetName();
49   void testSetStringContent();
50   void testSetNumericContent();
51   void testElementCount();
52   void testElementAtNegativeIndexThrow();
53   void testElementAtTooLargeIndexThrow();
54   void testElementAt();
55   void testElementForThrow();
56   void testElementFor();
57 
58   void testEmptyNodeToString();
59   void testElementWithAttributesToString();
60   void testEscapedAttributeValueToString();
61   void testElementToStringEscapeContent();
62   void testElementWithChildrenToString();
63   void testElementWithContentToString();
64   void testElementWithNumericContentToString();
65   void testElementWithContentAndChildToString();
66 
67 private:
68   /// Prevents the use of the copy constructor.
69   XmlElementTest( const XmlElementTest &copy );
70 
71   /// Prevents the use of the copy operator.
72   void operator =( const XmlElementTest &copy );
73 };
74 
75 
76 
77 #endif  // CPPUNITEST_XMLELEMENTTEST_H
78