示例#1
0
        /// <summary>
        /// Begins a call to the test service to write to the log.
        /// </summary>
        /// <param name="callback">The callback, used to read or verify results
        /// from the service call.</param>
        /// <param name="logName">The name of the log to write.</param>
        /// <param name="content">The log file content.</param>
        public override void WriteLog(Action <ServiceResult> callback, string logName, string content)
        {
            string guid = TestService.UniqueTestRunIdentifier;
            Dictionary <string, string> parameters = string.IsNullOrEmpty(guid) ? WebTestService.Dictionary("logName", logName) : WebTestService.Dictionary("guid", guid, "logName", logName);

            ((SilverlightTestService)TestService).WebService.CallMethod(MethodName_WriteLog, parameters, content, callback);
        }
示例#2
0
        /// <summary>
        /// Save string-based code coverage data.
        /// </summary>
        /// <param name="data">The code coverage data, as a string.</param>
        /// <param name="callback">The callback action.</param>
        public override void SaveCoverageData(string data, Action <ServiceResult> callback)
        {
            string guid = TestService.UniqueTestRunIdentifier;
            Dictionary <string, string> parameters = string.IsNullOrEmpty(guid) ? WebTestService.Dictionary() : WebTestService.Dictionary("guid", guid);

            ((SilverlightTestService)TestService).WebService.CallMethod(MethodName_SaveCodeCoverage, parameters, data, callback);
        }
示例#3
0
        /// <summary>
        /// Begins a call to the test service to report a test run's results.
        /// </summary>
        /// <param name="callback">The callback, used to read or verify results
        /// from the service call.</param>
        /// <param name="failure">A value indicating whether the test run was a
        /// failure.</param>
        /// <param name="failures">The failed scenario count.</param>
        /// <param name="totalScenarios">The total scenario count.</param>
        /// <param name="message">Any message to report along with the failure.</param>
        public override void ReportFinalResult(Action <ServiceResult> callback, bool failure, int failures, int totalScenarios, string message)
        {
            string guid = TestService.UniqueTestRunIdentifier;

            if (string.IsNullOrEmpty(guid))
            {
                Callback(callback, ServiceResult.CreateExceptionalResult(new NotSupportedException("A unique identifier for the test run is required.")));
            }

            Dictionary <string, string> parameters = WebTestService.Dictionary("failure", failure.ToString(CultureInfo.InvariantCulture), "total", totalScenarios.ToString(CultureInfo.InvariantCulture), "failures", failures.ToString(CultureInfo.InvariantCulture), "guid", guid);

            ((SilverlightTestService)TestService).WebService.CallMethod(MethodName_ReportTestResults, parameters, callback);
        }
示例#4
0
 /// <summary>
 /// Pauses the initialization process to attempt a service connection.
 /// The result will alter the underlying ServiceType being used by
 /// this provider to ensure a fallback experience can be used.
 ///
 /// This verification step will block the initialization and entire
 /// test run until it continues.
 /// </summary>
 private void AttemptServiceConnection()
 {
     _webService.Verify(
         // Success
         delegate
     {
         WebService = new WebTestService(_webService.ServiceUri);
         ContinueInitialization();
     },
         // Failure, fallback to the direct mode
         delegate
     {
         ServiceType = ServiceType.Direct;
         _webService = null;
         ContinueInitialization();
     });
 }
 /// <summary>
 /// Attempts to verify the service connection.  Calls the proper 
 /// success/failure Action once a verification result is possible.
 /// </summary>
 /// <param name="success">The Action to call upon connection 
 /// verification.</param>
 /// <param name="failure">An Action to call upon failure.</param>
 public void Verify(Action success, Action failure)
 {
     WebTestService pox = new WebTestService(ServiceUri);
     pox.CallMethod(
         VerificationServiceName,
         delegate(ServiceResult result)
         {
             if (result.Successful)
             {
                 success();
             }
             else
             {
                 failure();
             }
         });
 }
示例#6
0
            /// <summary>
            /// Attempts to verify the service connection.  Calls the proper
            /// success/failure Action once a verification result is possible.
            /// </summary>
            /// <param name="success">The Action to call upon connection
            /// verification.</param>
            /// <param name="failure">An Action to call upon failure.</param>
            public void Verify(Action success, Action failure)
            {
                WebTestService pox = new WebTestService(ServiceUri);

                pox.CallMethod(
                    VerificationServiceName,
                    delegate(ServiceResult result)
                {
                    if (result.Successful)
                    {
                        success();
                    }
                    else
                    {
                        failure();
                    }
                });
            }
示例#7
0
        /// <summary>
        /// Initialize the web settings provider.
        /// </summary>
        public override void Initialize()
        {
            SetPageTitle("Loading command line parameters...");

            string guid = TestService.UniqueTestRunIdentifier;

            if (string.IsNullOrEmpty(guid))
            {
                base.Initialize();
            }

            ((SilverlightTestService)TestService).WebService.CallMethod(MethodName_GetRunParameters, WebTestService.Dictionary("guid", guid), ReadRunParameters);
        }
 /// <summary>
 /// Pauses the initialization process to attempt a service connection. 
 /// The result will alter the underlying ServiceType being used by 
 /// this provider to ensure a fallback experience can be used.  
 /// 
 /// This verification step will block the initialization and entire 
 /// test run until it continues.
 /// </summary>
 private void AttemptServiceConnection()
 {
     _webService.Verify(
         // Success
         delegate
         {
             WebService = new WebTestService(_webService.ServiceUri);
             ContinueInitialization();
         },
         // Failure, fallback to the direct mode
         delegate
         {
             ServiceType = ServiceType.Direct;
             _webService = null;
             ContinueInitialization();
         });
 }
示例#9
0
 /// <summary>
 /// Retrieve an environment variable from the system.
 /// </summary>
 /// <param name="name">The variable name.</param>
 /// <param name="callback">The callback action.</param>
 public override void GetEnvironmentVariable(string name, Action <ServiceResult> callback)
 {
     ((SilverlightTestService)TestService).WebService.CallMethod(MethodName_GetEnvironmentVariable, WebTestService.Dictionary("name", name), callback);
 }