Unit tests for RemoteList are now ready
[irwi] / ut / ut_remotelist / ut_remotelist.h
index 478ca28..7db7764 100644 (file)
@@ -5,7 +5,10 @@
 #include <QStringList>
 #include <QMap>
 #include <QList>
+#include <QDomElement>
+
 #include "model.h"
+#include "remotelist.h"
 
 class Ut_RemoteList: public QObject
 {
@@ -14,19 +17,32 @@ class Ut_RemoteList: public QObject
 private slots:
     void initTestCase();
     void cleanupTestCase();
-    void init();
-    
-    void testSetContent();
+
     void testIsValid();
-    void testIsValid_InvalidFile();
-    void testIsValid_FileNotFound();
+    void testIsValid_setContent();
     void testLetters();
     void testManufacturers();
     void testModels();
+    void testLetters_setContent();
+    void testManufacturers_setContent();
+    void testModels_setContent();
+
+private:
+    // Creates the xml document containing the test data
+    void createDocument();
+
+    // Creates element for each mfg which name starts with the given letter.
+    void createMfgElements(QChar &letter, QDomElement &parent);
+    void createModelElements(const QString &mfg, QDomElement &parent);
+
+    void compareLetters(RemoteList &subject);
+    void compareManufacturers(RemoteList &subject);
+    void compareModels(RemoteList &subject);
 
 private:
-    QMap<QString, QStringList> validMfgs;       // letter -- mfgs
-    QMap<QString, QList<Model> > validModels;   // mfg ----- models
+    QDomDocument document;
+    QMap<QString, QStringList> validMfgs;
+    QMap<QString, QList<Model> > validModels;
 };
 
 #endif // UT_REMOTELIST_H