/// <summary> /// the AppsService is an application object holding several /// real services object. To allow the setting of advanced http properties, /// proxies and other things, we allow setting the factory class that is used. /// /// a getter does not make a lot of sense here, as which of the several factories in use /// are we getting? It also would give the illusion that you could get one object and then /// modify its settings. /// </summary> /// <param name="factory">The factory to use for the AppsService</param> /// <returns></returns> public void SetRequestFactory(IGDataRequestFactory factory) { if (factory == null) { throw new ArgumentNullException("factory", "The factory object should not be NULL"); } nicknameService.RequestFactory = factory; userAccountService.RequestFactory = factory; groupsService.RequestFactory = factory; }
public virtual void InitTest() { Tracing.InitTracing(); this.defaultHost = "http://localhost"; this.strRemoteHost = null; this.externalHosts = null; this.iIterations = 10; if (this.factory == null) { GDataLoggingRequestFactory factory = new GDataLoggingRequestFactory(this.ServiceName, this.ApplicationName); this.factory = (IGDataRequestFactory)factory; } ReadConfigFile(); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>private void ReadConfigFile()</summary> /// <returns> </returns> ////////////////////////////////////////////////////////////////////// protected virtual void ReadConfigFile() { this.unitTestConfiguration = (IDictionary)ConfigurationManager.GetSection("unitTestSection"); // 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 (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("resourcePath") == true) { this.resourcePath = (string)unitTestConfiguration["resourcePath"]; } if (unitTestConfiguration.Contains("requestlogging") == true) { bool flag = bool.Parse((string)unitTestConfiguration["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); } } this.externalHosts = (IDictionary)ConfigurationManager.GetSection("unitTestExternalHosts"); }
/// <summary> /// the appsservice is an application object holding several /// real services object. To allow the setting of advanced http properties, /// proxies and other things, we allow setting the factory class that is used. /// /// a getter does not make a lot of sense here, as which of the several factories in use /// are we getting? It also would give the illusion that you could get one object and then /// modify it's settings. /// </summary> /// <param name="factory">The factory to use for the AppsService</param> /// <returns></returns> public void SetRequestFactory(IGDataRequestFactory factory) { if (factory == null) { throw new ArgumentNullException("factory", "The factory object should not be NULL"); } emailListRecipientService.RequestFactory = factory; emailListService.RequestFactory = factory; nicknameService.RequestFactory = factory; userAccountService.RequestFactory = factory; groupsService.RequestFactory = factory; }
/// <summary>private void ReadConfigFile()</summary> /// <returns> </returns> protected virtual void ReadConfigFile() { this.unitTestConfiguration = (IDictionary)ConfigurationManager.GetSection("unitTestSection"); // 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 (unitTestConfiguration.Contains("defHost")) { this.defaultHost = (string)unitTestConfiguration["defHost"]; Tracing.TraceInfo("Read defaultHost value: " + this.defaultHost); } if (unitTestConfiguration.Contains("defRemoteHost")) { this.strRemoteHost = (string)unitTestConfiguration["defRemoteHost"]; Tracing.TraceInfo("Read default remote host value: " + this.strRemoteHost); } if (unitTestConfiguration.Contains("iteration")) { this.iIterations = int.Parse((string)unitTestConfiguration["iteration"]); } if (unitTestConfiguration.Contains("resourcePath")) { this.resourcePath = (string)unitTestConfiguration["resourcePath"]; } if (unitTestConfiguration.Contains("requestlogging")) { bool flag = bool.Parse((string)unitTestConfiguration["requestlogging"]); if (!flag) { // 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); } } this.externalHosts = (IDictionary)ConfigurationManager.GetSection("unitTestExternalHosts"); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>this will trigger the creation of an authenticating servicea</summary> ////////////////////////////////////////////////////////////////////// public Service(string service, string applicationName, string library) { this.GDataRequestFactory = new GDataGAuthRequestFactory(service, applicationName, library); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>this will trigger the creation of an authenticating service</summary> ////////////////////////////////////////////////////////////////////// public Service(string service, string applicationName) { this.GDataRequestFactory = new GDataGAuthRequestFactory(service, applicationName, GServiceAgent); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>default constructor, sets the default GDataRequest</summary> ////////////////////////////////////////////////////////////////////// public Service(string applicationName) { this.GDataRequestFactory = new GDataRequestFactory(applicationName + " " + GServiceAgent); }
////////////////////////////////////////////////////////////////////// /// <summary>default constructor, sets the default GDataRequest</summary> ////////////////////////////////////////////////////////////////////// public Service() { this.GDataRequestFactory = new GDataRequestFactory(GServiceAgent); }