FuncTest.Helpers.TestWebApplication.DoTest C# (CSharp) Méthode

DoTest() private méthode

The do test.
private DoTest ( Action action, bool instrumentRedApp = true ) : void
action Action The action.
instrumentRedApp bool Whether red app needs to be instrumented or not.
Résultat void
        internal void DoTest(Action<TestWebApplication> action, bool instrumentRedApp = true)
        {
            if (this.IsFirstTest)
            {
                this.IsFirstTest = false;
                this.ExecuteAnonymousRequest("?type=invalid&count=1");
            }

            action(this);
        }

Usage Example

        /// <summary>
        /// Helper to execute Sync Http tests
        /// </summary>
        /// <param name="testWebApplication">The test application for which tests are to be executed</param>
        /// <param name="success">indicates if the tests should test success or failure case</param>
        /// <param name="count">number to RDD calls to be made by the test application.  </param>
        /// <param name="accessTimeMax">approximate maximum time taken by RDD Call.  </param>
        public static void ExecuteSyncHttpPostTests(TestWebApplication testWebApplication, bool success, int count, TimeSpan accessTimeMax, string resultCodeExpected, string queryString)
        {
            testWebApplication.DoTest(
                application =>
            {
                var resourceNameExpected = success ? ResourceNameHttpToBing : ResourceNameHttpToFailedRequest;
                application.ExecuteAnonymousRequest(queryString + count);

                //// The above request would have trigged RDD module to monitor and create RDD telemetry
                //// Listen in the fake endpoint and see if the RDDTelemtry is captured
                var allItems  = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType <TelemetryItem <RemoteDependencyData> >(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents);
                var httpItems = allItems.Where(i => i.data.baseData.type == "Http").ToArray();

                // Validate the RDD Telemetry properties
                Assert.AreEqual(
                    count,
                    httpItems.Length,
                    "Total Count of Remote Dependency items for HTTP collected is wrong.");

                foreach (var httpItem in httpItems)
                {
                    Validate(httpItem, resourceNameExpected, accessTimeMax, success, "POST", resultCodeExpected);
                }
            });
        }
All Usage Examples Of FuncTest.Helpers.TestWebApplication::DoTest