public void EnsureTestCoverage() { SwaggerSpecRunner.RunTests( SwaggerPath("azure-report.json"), ExpectedPath("AzureReport"), generator: "Azure.CSharp"); using (var client = new AutoRestReportServiceForAzure(Fixture.Uri, new TokenCredentials(Guid.NewGuid().ToString()))) { var report = client.GetReport(); #if PORTABLE float totalTests = report.Count - 6; #else float totalTests = report.Count; #endif float executedTests = report.Values.Count(v => v > 0); if (executedTests < totalTests) { foreach (var r in report.Where(r => r.Value == 0)) { _interceptor.Information(string.Format(CultureInfo.CurrentCulture, "{0}/{1}", r.Key, r.Value)); } _interceptor.Information(string.Format(CultureInfo.CurrentCulture, "The test coverage for Azure is {0}/{1}", executedTests, totalTests)); Assert.Equal(executedTests, totalTests); } } }
public void EnsureTestCoverage() { SwaggerSpecHelper.RunTests <AzureCSharpCodeGenerator>( SwaggerPath("azure-report.json"), ExpectedPath("AzureReport")); using (var client = new AutoRestReportServiceForAzure(Fixture.Uri, new TokenCredentials(Guid.NewGuid().ToString()))) { var report = client.GetReport(); #if MONO float totalTests = report.Count - 5; #else float totalTests = report.Count; #endif float executedTests = report.Values.Count(v => v > 0); if (executedTests < totalTests) { report.ForEach(r => _output.WriteLine(string.Format(CultureInfo.CurrentCulture, Resources.TestCoverageReportItemFormat, r.Key, r.Value))); _output.WriteLine(string.Format(CultureInfo.CurrentCulture, Resources.TestCoverageReportSummaryFormat, executedTests, totalTests)); Assert.Equal(executedTests, totalTests); } } }