From 2112e4e208dc8fb3dbd2373c9d399069ad83d477 Mon Sep 17 00:00:00 2001 From: Deepak Shankargouda Date: Wed, 22 Aug 2018 13:52:14 -0700 Subject: [PATCH] Treating warnings as errors for A projects --- .../AnalysisServices.Tests/AnalysisServices.Tests.csproj | 6 +++--- .../ApiManagement.Tests/ApiManagement.Tests.csproj | 8 +++----- .../ManagementApiTests/ApiExportImportTests.cs | 6 +++--- .../ManagementApiTests/ReportTests.cs | 2 +- .../Data.ApplicationInsights.Tests.csproj | 1 - .../ApplicationInsights.Tests.csproj | 2 +- .../ScenarioTests/APIKeysTests.cs | 9 +++++---- .../ScenarioTests/ComponentsTests.cs | 2 +- .../ScenarioTests/ContinuousExportsTests.cs | 4 ++-- .../ApplicationInsights.Tests/ScenarioTests/TestBase.cs | 2 +- .../ScenarioTests/WebtestsTests.cs | 2 +- .../Authorization.Tests/Authorization.Tests.csproj | 6 +++--- .../Authorization.Tests/Tests/BasicTests.cs | 6 +++--- .../Automation/Automation.Tests/Automation.Tests.csproj | 6 +++--- 14 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/SDKs/AnalysisServices/AnalysisServices.Tests/AnalysisServices.Tests.csproj b/src/SDKs/AnalysisServices/AnalysisServices.Tests/AnalysisServices.Tests.csproj index 19d2658941b24..4c0813cbdab35 100644 --- a/src/SDKs/AnalysisServices/AnalysisServices.Tests/AnalysisServices.Tests.csproj +++ b/src/SDKs/AnalysisServices/AnalysisServices.Tests/AnalysisServices.Tests.csproj @@ -5,9 +5,9 @@ AnalysisServices.Tests AnalysisServices.Tests - + + true + diff --git a/src/SDKs/ApiManagement/ApiManagement.Tests/ApiManagement.Tests.csproj b/src/SDKs/ApiManagement/ApiManagement.Tests/ApiManagement.Tests.csproj index 65d7a8d6491b7..3ee749e9bdabc 100644 --- a/src/SDKs/ApiManagement/ApiManagement.Tests/ApiManagement.Tests.csproj +++ b/src/SDKs/ApiManagement/ApiManagement.Tests/ApiManagement.Tests.csproj @@ -7,11 +7,9 @@ Microsoft Corporation ApiManagementManagement.Tests - - - + + true + diff --git a/src/SDKs/ApiManagement/ApiManagement.Tests/ManagementApiTests/ApiExportImportTests.cs b/src/SDKs/ApiManagement/ApiManagement.Tests/ManagementApiTests/ApiExportImportTests.cs index ae834bad57331..679a976f2fe68 100644 --- a/src/SDKs/ApiManagement/ApiManagement.Tests/ManagementApiTests/ApiExportImportTests.cs +++ b/src/SDKs/ApiManagement/ApiManagement.Tests/ManagementApiTests/ApiExportImportTests.cs @@ -16,7 +16,7 @@ namespace ApiManagement.Tests.ManagementApiTests public class ApiExportImportTests : TestBase { [Fact] - public async Task SwaggerTest() + public void SwaggerTest() { Environment.SetEnvironmentVariable("AZURE_TEST_MODE", "Playback"); using (MockContext context = MockContext.Start(this.GetType().FullName)) @@ -76,7 +76,7 @@ public async Task SwaggerTest() } [Fact] - public async Task WadlTest() + public void WadlTest() { Environment.SetEnvironmentVariable("AZURE_TEST_MODE", "Playback"); using (MockContext context = MockContext.Start(this.GetType().FullName)) @@ -138,7 +138,7 @@ public async Task WadlTest() } [Fact] - public async Task WsdlTest() + public void WsdlTest() { Environment.SetEnvironmentVariable("AZURE_TEST_MODE", "Playback"); using (MockContext context = MockContext.Start(this.GetType().FullName)) diff --git a/src/SDKs/ApiManagement/ApiManagement.Tests/ManagementApiTests/ReportTests.cs b/src/SDKs/ApiManagement/ApiManagement.Tests/ManagementApiTests/ReportTests.cs index f9cf78111765a..c0f80325751aa 100644 --- a/src/SDKs/ApiManagement/ApiManagement.Tests/ManagementApiTests/ReportTests.cs +++ b/src/SDKs/ApiManagement/ApiManagement.Tests/ManagementApiTests/ReportTests.cs @@ -16,7 +16,7 @@ namespace ApiManagement.Tests.ManagementApiTests public class ReportTests : TestBase { [Fact] - public async Task Query() + public void Query() { Environment.SetEnvironmentVariable("AZURE_TEST_MODE", "Playback"); using (MockContext context = MockContext.Start(this.GetType().FullName)) diff --git a/src/SDKs/ApplicationInsights/DataPlane/Data.ApplicationInsights.Tests/Data.ApplicationInsights.Tests.csproj b/src/SDKs/ApplicationInsights/DataPlane/Data.ApplicationInsights.Tests/Data.ApplicationInsights.Tests.csproj index 9f4e88b8545c8..b4a42ccdfdc42 100644 --- a/src/SDKs/ApplicationInsights/DataPlane/Data.ApplicationInsights.Tests/Data.ApplicationInsights.Tests.csproj +++ b/src/SDKs/ApplicationInsights/DataPlane/Data.ApplicationInsights.Tests/Data.ApplicationInsights.Tests.csproj @@ -5,7 +5,6 @@ Data.ApplicationInsights.Tests Class library Data.ApplicationInsights.Tests 1.0.0-preview - diff --git a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ApplicationInsights.Tests.csproj b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ApplicationInsights.Tests.csproj index 20824203a314e..f4e9b79d72f27 100644 --- a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ApplicationInsights.Tests.csproj +++ b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ApplicationInsights.Tests.csproj @@ -5,7 +5,7 @@ ApplicationInsights.Tests Class library ApplicationInsights.Tests 1.0.0-preview - + true diff --git a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/APIKeysTests.cs b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/APIKeysTests.cs index 59ec9cc469da5..6250485cd6dc7 100644 --- a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/APIKeysTests.cs +++ b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/APIKeysTests.cs @@ -56,7 +56,7 @@ public void CreateGetListUpdateDeleteAPIKeys() .GetAwaiter() .GetResult(); - Assert.Equal(1, getAllAPIKeys.Body.Count()); + Assert.Single(getAllAPIKeys.Body); AreEqual(apiKeyProperties, getAllAPIKeys.Body.ElementAt(0)); string fullkeyId = getAllAPIKeys.Body.ElementAt(0).Id; @@ -85,7 +85,7 @@ public void CreateGetListUpdateDeleteAPIKeys() .GetResult(); //get API again, should get an NOT found exception - Assert.Throws(typeof(CloudException), () => + Assert.Throws(() => { getAPIKey = insightsClient .APIKeys @@ -109,12 +109,13 @@ private static void AreEqual(APIKeyRequest request, ApplicationInsightsComponent Assert.True(response.LinkedWriteProperties.Count >= request.LinkedWriteProperties.Count); foreach (var readaccess in request.LinkedReadProperties) { - Assert.True(response.LinkedReadProperties.Any(r => r == readaccess)); + Assert.Contains(response.LinkedReadProperties, r => r == readaccess); + } foreach (var writeaccess in request.LinkedWriteProperties) { - Assert.True(response.LinkedWriteProperties.Any(w => w == writeaccess)); + Assert.Contains(response.LinkedWriteProperties, w => w == writeaccess); } } diff --git a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/ComponentsTests.cs b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/ComponentsTests.cs index 45ccc01184e09..1c99b830557b2 100644 --- a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/ComponentsTests.cs +++ b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/ComponentsTests.cs @@ -111,7 +111,7 @@ public void CreateGetListUpdateDeleteComponents() .GetResult(); //get component again, should get an exception - Assert.Throws(typeof(CloudException), () => + Assert.Throws(() => { getComponentResponse = insightsClient .Components diff --git a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/ContinuousExportsTests.cs b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/ContinuousExportsTests.cs index 06ed2914f680e..376f67cb5ba4f 100644 --- a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/ContinuousExportsTests.cs +++ b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/ContinuousExportsTests.cs @@ -45,7 +45,7 @@ public void CreateGetListUpdateDeleteExports() createContinuousExportProperties) .GetAwaiter() .GetResult(); - Assert.Equal(1, createContinuousExportResponse.Body.Count()); + Assert.Single(createContinuousExportResponse.Body); AreEqual(createContinuousExportProperties, createContinuousExportResponse.Body.FirstOrDefault()); //get all continuous exports @@ -57,7 +57,7 @@ public void CreateGetListUpdateDeleteExports() .GetAwaiter() .GetResult(); - Assert.Equal(1, getAllContinuousExports.Body.Count()); + Assert.Single(getAllContinuousExports.Body); AreEqual(createContinuousExportProperties, getAllContinuousExports.Body.FirstOrDefault()); string exportId = getAllContinuousExports.Body.FirstOrDefault().ExportId; diff --git a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/TestBase.cs b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/TestBase.cs index b96aabab8e3eb..d73d47cdc797c 100644 --- a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/TestBase.cs +++ b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/TestBase.cs @@ -86,7 +86,7 @@ protected void DeleteAComponent(ApplicationInsightsManagementClient insightsClie .GetResult(); //get component again, should get an exception - Assert.Throws(typeof(CloudException), () => + Assert.Throws(() => { var getComponentResponse = insightsClient .Components diff --git a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/WebtestsTests.cs b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/WebtestsTests.cs index e64c1ac4ff492..d52fdd16e6883 100644 --- a/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/WebtestsTests.cs +++ b/src/SDKs/ApplicationInsights/Management/ApplicationInsights.Tests/ScenarioTests/WebtestsTests.cs @@ -103,7 +103,7 @@ public void CreateGetListUpdateDeleteWebtests() .GetResult(); //get webtest again, should get an exception - Assert.Throws(typeof(CloudException), () => + Assert.Throws(() => { getWebTestResponse = insightsClient .WebTests diff --git a/src/SDKs/Authorization/Authorization.Tests/Authorization.Tests.csproj b/src/SDKs/Authorization/Authorization.Tests/Authorization.Tests.csproj index a6a36ea418831..d646e62000653 100644 --- a/src/SDKs/Authorization/Authorization.Tests/Authorization.Tests.csproj +++ b/src/SDKs/Authorization/Authorization.Tests/Authorization.Tests.csproj @@ -5,9 +5,9 @@ Authorization.Tests Authorization.Tests - + + true + diff --git a/src/SDKs/Authorization/Authorization.Tests/Tests/BasicTests.cs b/src/SDKs/Authorization/Authorization.Tests/Tests/BasicTests.cs index ab6a2ff8dd886..504c47620895b 100644 --- a/src/SDKs/Authorization/Authorization.Tests/Tests/BasicTests.cs +++ b/src/SDKs/Authorization/Authorization.Tests/Tests/BasicTests.cs @@ -56,8 +56,8 @@ public void ClassicAdministratorListTests() { Assert.NotNull(classicAdmin); Assert.NotNull(classicAdmin.Id); - Assert.True(classicAdmin.Id.Contains("/providers/Microsoft.Authorization/classicAdministrators/")); - Assert.True(classicAdmin.Id.Contains("/subscriptions/" + client.SubscriptionId)); + Assert.Contains("/providers/Microsoft.Authorization/classicAdministrators/", classicAdmin.Id); + Assert.Contains("/subscriptions/" + client.SubscriptionId, classicAdmin.Id); Assert.NotNull(classicAdmin.Name); Assert.NotNull(classicAdmin.Type); Assert.Equal("Microsoft.Authorization/classicAdministrators", classicAdmin.Type); @@ -436,7 +436,7 @@ public void RoleAssignmentPagingTest() var nextPage = client.RoleAssignments.ListNext(firstPage.NextPageLink); Assert.NotNull(nextPage); - Assert.NotEqual(0, nextPage.Count()); + Assert.NotEmpty(nextPage); foreach (var roleAssignment in nextPage) { diff --git a/src/SDKs/Automation/Automation.Tests/Automation.Tests.csproj b/src/SDKs/Automation/Automation.Tests/Automation.Tests.csproj index 6862e69de8631..27a5d543a6e5c 100644 --- a/src/SDKs/Automation/Automation.Tests/Automation.Tests.csproj +++ b/src/SDKs/Automation/Automation.Tests/Automation.Tests.csproj @@ -7,9 +7,9 @@ Test Project for Automation tests - + + true +