public void BindingType_Metrics() { var expectedMetrics = new List <Assertions.ExpectedMetric>(); var unexpectedMetrics = new List <Assertions.ExpectedMetric>(); var bindingName = $"{_bindingToTest}Binding"; if (SystemBindingNames.Contains(bindingName)) { expectedMetrics.Add(new Assertions.ExpectedMetric() { metricName = $"Supportability/WCFService/BindingType/{bindingName}", callCount = 1 }); } else { expectedMetrics.Add(new Assertions.ExpectedMetric() { metricName = $"Supportability/WCFService/BindingType/CustomBinding", callCount = 1 }); if (_bindingToTest != WCFBindingType.Custom) { unexpectedMetrics.Add(new Assertions.ExpectedMetric() { metricName = $"Supportability/WCFService/BindingType/{_bindingToTest}Binding" }); } } var assertions = new List <Action>(); assertions.Add(() => Assertions.MetricsExist(expectedMetrics, LogHelpers.MetricValues)); assertions.Add(() => Assertions.MetricsDoNotExist(unexpectedMetrics, LogHelpers.MetricValues)); NrAssert.Multiple(assertions.ToArray()); }
public void BindingType_Metrics() { var bindingName = $"{_bindingToTest}Binding"; var expectedMetrics = SystemBindingNames.Contains(bindingName) ? new List <Assertions.ExpectedMetric> { new Assertions.ExpectedMetric() { metricName = $"Supportability/WCFClient/BindingType/{bindingName}", callCount = 1 } } : new List <Assertions.ExpectedMetric> { new Assertions.ExpectedMetric() { metricName = $"Supportability/WCFClient/BindingType/CustomBinding", callCount = 1 } }; var unexpectedMetrics = SystemBindingNames.Where(binding => binding != bindingName).Select(binding => new Assertions.ExpectedMetric() { metricName = $"Supportability/WCFClient/BindingType/{binding}" }).ToList(); if (bindingName != "CustomBinding" && bindingName != "CustomClassBinding") { unexpectedMetrics.Add(new Assertions.ExpectedMetric() { metricName = $"Supportability/WCFClient/BindingType/CustomBinding" }); } NrAssert.Multiple( () => Assertions.MetricsExist(expectedMetrics, LogHelpers.MetricValues), () => Assertions.MetricsDoNotExist(unexpectedMetrics, LogHelpers.MetricValues) ); }