Author: siwuzzz
Date: Thu May 10 19:56:11 2007
New Revision: 147

Modified:
   trunk/clients/cs/src/unittests/blogger.cs
   trunk/clients/cs/src/unittests/caltest.cs
   trunk/clients/cs/src/unittests/gbase.cs
   trunk/clients/cs/src/unittests/unittests.cs

Log:
blogger.cs, caltest.cs, gbase.cs, unittests.cs:
Changed settings presence verification from IDictionnary.this[] to 
IDictionnary.Contains(), in InitTest()

unittests.cs:
Modified the BaseTestClass.InitTest() method to parse the config file only once 
(and not having to do it in every subclasses). Added a member, IDictionnary 
unitTestConfiguration.

Modified: trunk/clients/cs/src/unittests/blogger.cs
==============================================================================
--- trunk/clients/cs/src/unittests/blogger.cs   (original)
+++ trunk/clients/cs/src/unittests/blogger.cs   Thu May 10 19:56:11 2007
@@ -90,32 +90,27 @@
         //////////////////////////////////////////////////////////////////////
         protected override void ReadConfigFile()
         {
-            base.ReadConfigFile(); 
+            base.ReadConfigFile();
 
-            IDictionary unitTestDictionary = (IDictionary) 
ConfigurationSettings.GetConfig("unitTestSection");
-
-            if (unitTestDictionary != null)
+            if (unitTestConfiguration.Contains("authHandler") == true)
+            {
+                this.strAuthHandler = (string) 
unitTestConfiguration["authHandler"];
+                Tracing.TraceInfo("Read authHandler value: " + 
this.strAuthHandler);
+            }
+            if (unitTestConfiguration.Contains("bloggerURI") == true)
+            {
+                this.bloggerURI = (string) unitTestConfiguration["bloggerURI"];
+                Tracing.TraceInfo("Read bloggerURI value: " + this.bloggerURI);
+            }
+            if (unitTestConfiguration.Contains("userName") == true)
+            {
+                this.userName = (string) unitTestConfiguration["userName"];
+                Tracing.TraceInfo("Read userName value: " + this.userName);
+            }
+            if (unitTestConfiguration.Contains("passWord") == true)
             {
-                if (unitTestDictionary["authHandler"] != null)
-                {
-                    this.strAuthHandler = (string) 
unitTestDictionary["authHandler"];
-                    Tracing.TraceInfo("Read authHandler value: " + 
this.strAuthHandler); 
-                }
-                if (unitTestDictionary["bloggerURI"] != null)
-                {
-                    this.bloggerURI = (string) 
unitTestDictionary["bloggerURI"];
-                    Tracing.TraceInfo("Read bloggerURI value: " + 
this.bloggerURI); 
-                }
-                if (unitTestDictionary["userName"] != null)
-                {
-                    this.userName = (string) unitTestDictionary["userName"];
-                    Tracing.TraceInfo("Read userName value: " + 
this.userName); 
-                }
-                if (unitTestDictionary["passWord"] != null)
-                {
-                    this.passWord = (string) unitTestDictionary["passWord"];
-                    Tracing.TraceInfo("Read passWord value: " + 
this.passWord); 
-                }
+                this.passWord = (string) unitTestConfiguration["passWord"];
+                Tracing.TraceInfo("Read passWord value: " + this.passWord);
             }
         }
         
/////////////////////////////////////////////////////////////////////////////

Modified: trunk/clients/cs/src/unittests/caltest.cs
==============================================================================
--- trunk/clients/cs/src/unittests/caltest.cs   (original)
+++ trunk/clients/cs/src/unittests/caltest.cs   Thu May 10 19:56:11 2007
@@ -96,37 +96,32 @@
         //////////////////////////////////////////////////////////////////////
         protected override void ReadConfigFile()
         {
-            base.ReadConfigFile(); 
+            base.ReadConfigFile();
 
-            IDictionary unitTestDictionary = (IDictionary) 
ConfigurationSettings.GetConfig("unitTestSection");
-
-            if (unitTestDictionary != null)
+            if (unitTestConfiguration.Contains("authHandler") == true)
+            {
+                this.strAuthHandler = (string) 
unitTestConfiguration["authHandler"];
+                Tracing.TraceInfo("Read authHandler value: " + 
this.strAuthHandler);
+            }
+            if (unitTestConfiguration.Contains("calendarURI") == true)
+            {
+                this.defaultCalendarUri = (string) 
unitTestConfiguration["calendarURI"];
+                Tracing.TraceInfo("Read calendarURI value: " + 
this.defaultCalendarUri);
+            }
+            if (unitTestConfiguration.Contains("compositeURI") == true)
+            {
+                this.defaultCompositeUri = (string) 
unitTestConfiguration["compositeURI"];
+                Tracing.TraceInfo("Read compositeURI value: " + 
this.defaultCompositeUri);
+            }
+            if (unitTestConfiguration.Contains("userName") == true)
+            {
+                this.userName = (string) unitTestConfiguration["userName"];
+                Tracing.TraceInfo("Read userName value: " + this.userName);
+            }
+            if (unitTestConfiguration.Contains("passWord") == true)
             {
-                if (unitTestDictionary["authHandler"] != null)
-                {
-                    this.strAuthHandler = (string) 
unitTestDictionary["authHandler"];
-                    Tracing.TraceInfo("Read authHandler value: " + 
this.strAuthHandler); 
-                }
-                if (unitTestDictionary["calendarURI"] != null)
-                {
-                    this.defaultCalendarUri = (string) 
unitTestDictionary["calendarURI"];
-                    Tracing.TraceInfo("Read calendarURI value: " + 
this.defaultCalendarUri); 
-                }
-                if (unitTestDictionary["compositeURI"] != null)
-                {
-                    this.defaultCompositeUri = (string) 
unitTestDictionary["compositeURI"];
-                    Tracing.TraceInfo("Read compositeURI value: " + 
this.defaultCompositeUri); 
-                }
-                if (unitTestDictionary["userName"] != null)
-                {
-                    this.userName = (string) unitTestDictionary["userName"];
-                    Tracing.TraceInfo("Read userName value: " + 
this.userName); 
-                }
-                if (unitTestDictionary["passWord"] != null)
-                {
-                    this.passWord = (string) unitTestDictionary["passWord"];
-                    Tracing.TraceInfo("Read passWord value: " + 
this.passWord); 
-                }
+                this.passWord = (string) unitTestConfiguration["passWord"];
+                Tracing.TraceInfo("Read passWord value: " + this.passWord);
             }
         }
         
/////////////////////////////////////////////////////////////////////////////

Modified: trunk/clients/cs/src/unittests/gbase.cs
==============================================================================
--- trunk/clients/cs/src/unittests/gbase.cs     (original)
+++ trunk/clients/cs/src/unittests/gbase.cs     Thu May 10 19:56:11 2007
@@ -86,38 +86,32 @@
         //////////////////////////////////////////////////////////////////////
         protected override void ReadConfigFile()
         {
-            base.ReadConfigFile(); 
+            base.ReadConfigFile();
 
-            IDictionary unitTestDictionary = (IDictionary) 
ConfigurationSettings.GetConfig("unitTestSection");
-
-            if (unitTestDictionary != null)
+            if (unitTestConfiguration.Contains("authHandler") == true)
             {
-                if (unitTestDictionary["authHandler"] != null)
-                {
-                    this.strAuthHandler = (string) 
unitTestDictionary["authHandler"];
-                    Tracing.TraceInfo("Read authHandler value: " + 
this.strAuthHandler); 
-                }
-                if (unitTestDictionary["gBaseURI"] != null)
-                {
-                    this.gBaseURI = (string) unitTestDictionary["gBaseURI"];
-                    Tracing.TraceInfo("Read gBase URI value: " + 
this.gBaseURI); 
-                }
-                if (unitTestDictionary["userName"] != null)
-                {
-                    this.userName = (string) unitTestDictionary["userName"];
-                    Tracing.TraceInfo("Read userName value: " + 
this.userName); 
-                }
-                if (unitTestDictionary["passWord"] != null)
-                {
-                    this.passWord = (string) unitTestDictionary["passWord"];
-                    Tracing.TraceInfo("Read passWord value: " + 
this.passWord); 
-                }
-                if (unitTestDictionary["gBaseKey"] != null)
-                {
-                    this.gBaseKey = (string) unitTestDictionary["gBaseKey"];
-                    Tracing.TraceInfo("Read gBaseKey value: " + 
this.gBaseKey); 
-                }
-
+                this.strAuthHandler = (string) 
unitTestConfiguration["authHandler"];
+                Tracing.TraceInfo("Read authHandler value: " + 
this.strAuthHandler);
+            }
+            if (unitTestConfiguration.Contains("gBaseURI") == true)
+            {
+                this.gBaseURI = (string) unitTestConfiguration["gBaseURI"];
+                Tracing.TraceInfo("Read gBase URI value: " + this.gBaseURI);
+            }
+            if (unitTestConfiguration.Contains("userName") == true)
+            {
+                this.userName = (string) unitTestConfiguration["userName"];
+                Tracing.TraceInfo("Read userName value: " + this.userName);
+            }
+            if (unitTestConfiguration.Contains("passWord") == true)
+            {
+                this.passWord = (string) unitTestConfiguration["passWord"];
+                Tracing.TraceInfo("Read passWord value: " + this.passWord);
+            }
+            if (unitTestConfiguration.Contains("gBaseKey") == true)
+            {
+                this.gBaseKey = (string) unitTestConfiguration["gBaseKey"];
+                Tracing.TraceInfo("Read gBaseKey value: " + this.gBaseKey);
             }
         }
         
/////////////////////////////////////////////////////////////////////////////

Modified: trunk/clients/cs/src/unittests/unittests.cs
==============================================================================
--- trunk/clients/cs/src/unittests/unittests.cs (original)
+++ trunk/clients/cs/src/unittests/unittests.cs Thu May 10 19:56:11 2007
@@ -48,6 +48,8 @@
         protected int iIterations; 
         /// <summary>holds the logging factory</summary> 
         protected IGDataRequestFactory factory; 
+        /// <summary>holds the configuration of the test found in the 
dll.config file</summary>
+        protected IDictionary   unitTestConfiguration;
 
 
 
@@ -154,34 +156,34 @@
         //////////////////////////////////////////////////////////////////////
         protected virtual void ReadConfigFile()
         {
-            IDictionary unitTestDictionary = (IDictionary) 
ConfigurationSettings.GetConfig("unitTestSection");
+            this.unitTestConfiguration = (IDictionary) 
ConfigurationSettings.GetConfig("unitTestSection");
 
-            if (unitTestDictionary != null)
-            {
-                if (unitTestDictionary["defHost"] != null)
-                {
-                    this.defaultHost = (string) unitTestDictionary["defHost"];
-                    Tracing.TraceInfo("Read defaultHost value: " + 
this.defaultHost); 
-                }
-                if (unitTestDictionary["defRemoteHost"] != null)
-                {
-                    this.strRemoteHost = (string) 
unitTestDictionary["defRemoteHost"];
-                    Tracing.TraceInfo("Read default remote host value: " + 
this.strRemoteHost); 
-                }
+            // no need to go further if the configuration file is needed.
+            if (unitTestConfiguration == null)
+                throw new FileNotFoundException("The DLL configuration file 
wasn't found, aborting.");
 
-                if (unitTestDictionary["iteration"] != null)
-                {
-                    this.iIterations = 
int.Parse((string)unitTestDictionary["iteration"]);
-                }
-                if (unitTestDictionary["requestlogging"] != null)
+            if (unitTestConfiguration.Contains("defHost") == true)
+            {
+                this.defaultHost = (string) unitTestConfiguration["defHost"];
+                Tracing.TraceInfo("Read defaultHost value: " + 
this.defaultHost);
+            }
+            if (unitTestConfiguration.Contains("defRemoteHost") == true)
+            {
+                this.strRemoteHost = (string) 
unitTestConfiguration["defRemoteHost"];
+                Tracing.TraceInfo("Read default remote host value: " + 
this.strRemoteHost);
+            }
+            if (unitTestConfiguration.Contains("iteration") == true)
+            {
+                this.iIterations = 
int.Parse((string)unitTestConfiguration["iteration"]);
+            }
+            if (unitTestConfiguration.Contains("requestlogging") == true)
+            {
+                bool flag = bool.Parse((string) 
unitTestConfiguration["requestlogging"]);
+                if (flag == false)
                 {
-                    bool flag = bool.Parse((string) 
unitTestDictionary["requestlogging"]); 
-                    if (flag == false)
-                    {
-                        // we are creating the logging factory by default. If 
-                        // tester set's it off, create the standard factory. 
-                        this.factory = new 
GDataGAuthRequestFactory(this.ServiceName, this.ApplicationName); 
-                    }
+                    // we are creating the logging factory by default. If 
+                    // tester set's it off, create the standard factory. 
+                    this.factory = new 
GDataGAuthRequestFactory(this.ServiceName, this.ApplicationName);
                 }
             }
 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to