private void Validate(TelemetryItem <RemoteDependencyData> itemToValidate, Uri expectedUrl, TimeSpan accessTimeMax, bool successFlagExpected, string verb) { if ("rddp" == DeploymentAndValidationTools.ExpectedSDKPrefix) { Assert.AreEqual(verb + " " + expectedUrl.AbsolutePath, itemToValidate.data.baseData.name, "For StatusMonitor implementation we expect verb to be collected."); Assert.AreEqual(expectedUrl.Host, itemToValidate.data.baseData.target); Assert.AreEqual(expectedUrl.OriginalString, itemToValidate.data.baseData.data); } DeploymentAndValidationTools.Validate(itemToValidate, accessTimeMax, successFlagExpected); }
private void Validate(TelemetryItem <RemoteDependencyData> itemToValidate, string targetExpected, string commandNameExpected, TimeSpan accessTimeMax, bool successFlagExpected, List <string> sqlErrorCodesExpected, List <string> sqlErrorMessagesExpected) { // For http name is validated in test itself Assert.IsTrue(itemToValidate.data.baseData.target.Contains(targetExpected), "The remote dependancy target is incorrect. Expected: " + targetExpected + ". Collected: " + itemToValidate.data.baseData.target); Assert.IsTrue(sqlErrorCodesExpected.Contains(itemToValidate.data.baseData.resultCode)); //If the command name is expected to be empty, the deserializer will make the CommandName null if ("rddp" == DeploymentAndValidationTools.ExpectedSDKPrefix) { // Additional checks for profiler collection if (sqlErrorMessagesExpected != null) { bool found = false; var errorMessage = itemToValidate.data.baseData.properties["ErrorMessage"]; foreach (var message in sqlErrorMessagesExpected) { if (errorMessage.Contains(message)) { found = true; break; } } Assert.IsTrue(found, "The error message is incorrect"); } if (string.IsNullOrEmpty(commandNameExpected)) { Assert.IsNull(itemToValidate.data.baseData.data); } else { Assert.IsTrue(itemToValidate.data.baseData.data.Equals(commandNameExpected), "The command name is incorrect"); } } DeploymentAndValidationTools.Validate(itemToValidate, accessTimeMax, successFlagExpected); }
private void Validate(TelemetryItem <RemoteDependencyData> itemToValidate, string targetExpected, string commandNameExpected, TimeSpan accessTimeMax, bool successFlagExpected, string sqlErrorCodeExpected, string sqlErrorMessageExpected) { // For http name is validated in test itself Assert.IsTrue(itemToValidate.data.baseData.target.Contains(targetExpected), "The remote dependancy target is incorrect. Expected: " + targetExpected + ". Collected: " + itemToValidate.data.baseData.target); Assert.AreEqual(sqlErrorCodeExpected, itemToValidate.data.baseData.resultCode); //If the command name is expected to be empty, the deserializer will make the CommandName null if ("rddp" == DeploymentAndValidationTools.ExpectedSqlSDKPrefix) { // Additional checks for profiler collection if (!string.IsNullOrEmpty(sqlErrorMessageExpected)) { Assert.AreEqual(sqlErrorMessageExpected, itemToValidate.data.baseData.properties["ErrorMessage"]); } if (string.IsNullOrEmpty(commandNameExpected)) { Assert.IsNull(itemToValidate.data.baseData.data); } else { Assert.IsTrue(itemToValidate.data.baseData.data.Equals(commandNameExpected), "The command name is incorrect"); } } DeploymentAndValidationTools.Validate(itemToValidate, accessTimeMax, successFlagExpected, sqlErrorCodeExpected); }