Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treating warnings as errors for test projects Part-1 #4694

Merged
merged 1 commit into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<AssemblyName>AnalysisServices.Tests</AssemblyName>
<PackageId>AnalysisServices.Tests</PackageId>
</PropertyGroup>
<!--<PropertyGroup>
<TargetFrameworks>netcoreapp1.1</TargetFrameworks>
</PropertyGroup>-->
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Management.Analysis\Microsoft.Azure.Management.Analysis.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
<Authors>Microsoft Corporation</Authors>
<AssemblyName>ApiManagementManagement.Tests</AssemblyName>
</PropertyGroup>

<!--<PropertyGroup>
<TargetFrameworks>netcoreapp1.1</TargetFrameworks>
</PropertyGroup>-->

<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<!--<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="2.1.0-ForTest" />-->
<ProjectReference Include="..\Management.ApiManagement\Microsoft.Azure.Management.ApiManagement.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<Description>Data.ApplicationInsights.Tests Class library</Description>
<PackageId>Data.ApplicationInsights.Tests</PackageId>
<VersionPrefix>1.0.0-preview</VersionPrefix>
<!--<TargetFrameworks>netcoreapp1.1</TargetFrameworks>-->
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Description>ApplicationInsights.Tests Class library</Description>
<PackageId>ApplicationInsights.Tests</PackageId>
<VersionPrefix>1.0.0-preview</VersionPrefix>
<!--<TargetFrameworks>netcoreapp1.1</TargetFrameworks>-->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="[1.6.0-preview, 2.0.0)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -85,7 +85,7 @@ public void CreateGetListUpdateDeleteAPIKeys()
.GetResult();

//get API again, should get an NOT found exception
Assert.Throws(typeof(CloudException), () =>
Assert.Throws<CloudException>(() =>
{
getAPIKey = insightsClient
.APIKeys
Expand All @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void CreateGetListUpdateDeleteComponents()
.GetResult();

//get component again, should get an exception
Assert.Throws(typeof(CloudException), () =>
Assert.Throws<CloudException>(() =>
{
getComponentResponse = insightsClient
.Components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected void DeleteAComponent(ApplicationInsightsManagementClient insightsClie
.GetResult();

//get component again, should get an exception
Assert.Throws(typeof(CloudException), () =>
Assert.Throws<CloudException>(() =>
{
var getComponentResponse = insightsClient
.Components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void CreateGetListUpdateDeleteWebtests()
.GetResult();

//get webtest again, should get an exception
Assert.Throws(typeof(CloudException), () =>
Assert.Throws<CloudException>(() =>
{
getWebTestResponse = insightsClient
.WebTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<AssemblyName>Authorization.Tests</AssemblyName>
<PackageId>Authorization.Tests</PackageId>
</PropertyGroup>
<!--<PropertyGroup>
<TargetFrameworks>netcoreapp1.1</TargetFrameworks>
</PropertyGroup>-->
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/SDKs/Automation/Automation.Tests/Automation.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<Description>Test Project for Automation tests</Description>
</PropertyGroup>

<!--<PropertyGroup>
<TargetFrameworks>netcoreapp1.1</TargetFrameworks>
</PropertyGroup>-->
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Network" Version="[14.0.0-preview,16.0)" />
Expand Down