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

chore: cleanup usage of obsolete members and async suffixes in test project #909

Merged
merged 2 commits into from
Sep 4, 2024
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 @@ -64,7 +64,7 @@ public IDecryptableContentExtensionsTests()
}

[Fact]
public async Task DecryptableContentCanBeDecryptedWithCertificate()
public async Task DecryptableContentCanBeDecryptedWithCertificateAsync()
{
// Arrange
var testChangeNotificationEncryptedContent = new TestChangeNotificationEncryptedContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<LangVersion>latest</LangVersion>
<NoWarn>CS0618</NoWarn>
</PropertyGroup>
<ItemGroup>
<None Update="xunit.runner.json">
Expand Down Expand Up @@ -35,6 +34,10 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<ProjectReference Include="..\..\src\Microsoft.Graph.Core\Microsoft.Graph.Core.csproj" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public void Dispose()
}

[Fact]
public async Task PollForOperationCompletionAsync_IsCancelled()
public async Task PollForOperationCompletionAsync_IsCancelledAsync()
{
var item = await this.asyncMonitor.PollForOperationCompletionAsync(this.progress.Object, new CancellationToken(true));
Assert.Null(item);
}

[Fact]
public async Task PollForOperationCompletionAsync_OperationCompleted()
public async Task PollForOperationCompletionAsync_OperationCompletedAsync()
{
bool called = false;
this.progress.Setup(
Expand Down Expand Up @@ -96,7 +96,7 @@ public async Task PollForOperationCompletionAsync_OperationCompleted()
}

[Fact]
public async Task PollForOperationCompletionAsync_OperationCancelled()
public async Task PollForOperationCompletionAsync_OperationCancelledAsync()
{
this.requestAdapter
.Setup(requestAdapter => requestAdapter.SendNoContentAsync(It.IsAny<RequestInformation>(), It.IsAny<Dictionary<string, ParsableFactory<IParsable>>>(), It.IsAny<CancellationToken>()))
Expand All @@ -112,7 +112,7 @@ public async Task PollForOperationCompletionAsync_OperationCancelled()
}

[Fact]
public async Task PollForOperationCompletionAsync_OperationDeleteFailed()
public async Task PollForOperationCompletionAsync_OperationDeleteFailedAsync()
{
this.requestAdapter
.Setup(requestAdapter => requestAdapter.SendNoContentAsync(It.IsAny<RequestInformation>(), It.IsAny<Dictionary<string, ParsableFactory<IParsable>>>(), It.IsAny<CancellationToken>()))
Expand All @@ -128,7 +128,7 @@ public async Task PollForOperationCompletionAsync_OperationDeleteFailed()
}

[Fact]
public async Task PollForOperationCompletionAsync_OperationFailed()
public async Task PollForOperationCompletionAsync_OperationFailedAsync()
{
this.requestAdapter
.Setup(requestAdapter => requestAdapter.SendNoContentAsync(It.IsAny<RequestInformation>(), It.IsAny<Dictionary<string, ParsableFactory<IParsable>>>(), It.IsAny<CancellationToken>()))
Expand All @@ -144,7 +144,7 @@ public async Task PollForOperationCompletionAsync_OperationFailed()
}

[Fact]
public async Task PollForOperationCompletionAsync_OperationNull()
public async Task PollForOperationCompletionAsync_OperationNullAsync()
{
this.requestAdapter
.Setup(requestAdapter => requestAdapter.SendNoContentAsync(It.IsAny<RequestInformation>(), It.IsAny<Dictionary<string, ParsableFactory<IParsable>>>(), It.IsAny<CancellationToken>()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public async Task BatchRequestBuilderAsync()
BatchRequestStep requestStep2 = new BatchRequestStep("2", httpRequestMessage2, new List<string> { "1" });

// 4.3 Add batch request steps to BatchRequestContent.
#pragma warning disable CS0618 // Type or member is obsolete use the BatchRequestContentCollection for making batch requests
BatchRequestContent batchRequestContent = new BatchRequestContent(baseClient, requestStep1, requestStep2);
#pragma warning restore CS0618 // Type or member is obsolete use the BatchRequestContentCollection for making batch requests
var requestInformation = await batchRequestBuilder.ToPostRequestInformationAsync(batchRequestContent);

// Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

#pragma warning disable CS0618 // Type or member is obsolete Guidance is to use the BatchRequestContentCollection for making batch requests
namespace Microsoft.Graph.DotnetCore.Core.Test.Requests.Content
{
using System;
Expand Down Expand Up @@ -184,7 +185,7 @@ public void BatchRequestContent_RemoveBatchRequestStepWithIdForNonExistingId()
}

[Fact]
public async Task BatchRequestContent_NewBatchWithFailedRequests()
public async Task BatchRequestContent_NewBatchWithFailedRequestsAsync()
{
BatchRequestContentCollection batchRequestContent = new BatchRequestContentCollection(client);
var requestIds = new List<string>();
Expand All @@ -208,7 +209,7 @@ public async Task BatchRequestContent_NewBatchWithFailedRequests()
}

[Fact]
public async Task BatchRequestContent_NewBatchWithFailedRequests2()
public async Task BatchRequestContent_NewBatchWithFailedRequests2Async()
{
BatchRequestContentCollection batchRequestContent = new BatchRequestContentCollection(client);
var requestIds = new List<string>();
Expand All @@ -230,7 +231,7 @@ public async Task BatchRequestContent_NewBatchWithFailedRequests2()
}

[Fact]
public async Task BatchRequestContent_NewBatchWithFailedRequestsWithBody()
public async Task BatchRequestContent_NewBatchWithFailedRequestsWithBodyAsync()
{
BatchRequestContentCollection batchRequestContent = new BatchRequestContentCollection(client);
var requestIds = new List<string>();
Expand Down Expand Up @@ -311,7 +312,7 @@ public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestCont
}

[Fact]
public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestContentSupportsNonJsonPayload()
public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestContentSupportsNonJsonPayloadAsync()
{
using var fileStream = File.Open("ms-logo.png", FileMode.Open);
BatchRequestStep batchRequestStep1 = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL));
Expand Down Expand Up @@ -364,7 +365,7 @@ public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestCont
}

[Fact]
public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestContentFromStepAsyncDoesNotModifyDateTimes()
public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestContentFromStepAsyncDoesNotModifyDateTimesAsync()
{
// System.Text.Json is strict on json content by default. So make sure that there are no
// trailing comma's and special characters
Expand Down Expand Up @@ -468,7 +469,7 @@ public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestCont
}

[Fact]
public async Task BatchRequest_GetBathRequestContentAsyncRetainsInsertionOrder()
public async Task BatchRequest_GetBathRequestContentAsyncRetainsInsertionOrderAsync()
{
BatchRequestStep batchRequestStep1 = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL));
BatchRequestStep batchRequestStep2 = new BatchRequestStep(Guid.NewGuid().ToString(), new HttpRequestMessage(HttpMethod.Get, REQUEST_URL), new List<string> { "1" });
Expand Down Expand Up @@ -537,7 +538,7 @@ public void BatchRequestContent_AddBatchRequestStepWithHttpRequestMessageToBatch
}

[Fact]
public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequest()
public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestAsync()
{
// Arrange
RequestInformation requestInformation = new RequestInformation() { HttpMethod = Method.GET, UrlTemplate = REQUEST_URL };
Expand All @@ -556,7 +557,7 @@ public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequest()
}

[Fact]
public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestWithHeaderOptions()
public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestWithHeaderOptionsAsync()
{
// Create a BatchRequestContent from a BaseRequest object
BatchRequestContent batchRequestContent = new BatchRequestContent(client);
Expand Down Expand Up @@ -593,7 +594,7 @@ public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestWithHead
}

[Fact]
public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestToBatchRequestContentWithMaxSteps()
public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestToBatchRequestContentWithMaxStepsAsync()
{
// Arrange
BatchRequestContent batchRequestContent = new BatchRequestContent(client);
Expand Down Expand Up @@ -623,7 +624,7 @@ public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestToBatchR
[InlineData("https://graph.microsoft.com/beta/users/[email protected]/events", "/users/[email protected]/events")]
[InlineData("https://graph.microsoft.com/v1.0/users?$filter=identities/any(id:id/issuer%20eq%20'$74707853-18b3-411f-ad57-2ef65f6fdeb0'%20and%20id/issuerAssignedId%20eq%20'**[email protected]**')", "/users?$filter=identities/any(id:id/issuer eq '$74707853-18b3-411f-ad57-2ef65f6fdeb0' and id/issuerAssignedId eq '**[email protected]**')")]
[InlineData("https://graph.microsoft.com/beta/users?$filter=identities/any(id:id/issuer%20eq%20'$74707853-18b3-411f-ad57-2ef65f6fdeb0'%20and%20id/issuerAssignedId%20eq%20'**[email protected]**')&$top=1", "/users?$filter=identities/any(id:id/issuer eq '$74707853-18b3-411f-ad57-2ef65f6fdeb0' and id/issuerAssignedId eq '**[email protected]**')&$top=1")]
public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestProperlySetsVersion(string requestUrl, string expectedUrl)
public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestProperlySetsVersionAsync(string requestUrl, string expectedUrl)
{
// Arrange
BatchRequestStep batchRequestStep = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, requestUrl));
Expand All @@ -647,7 +648,7 @@ public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestProperly

[Theory]
[InlineData("https://graph.microsoft.com/v1.0/drives/b%21ynG/items/74707853-18b3-411f-ad57-2ef65f6fdeb0:/test.txt:/textfilecontentbytes", "/drives/b!ynG/items/74707853-18b3-411f-ad57-2ef65f6fdeb0:/test.txt:/textfilecontentbytes")]
public async Task BatchRequestContent_AddBatchRequestPutStepWithBaseRequestProperlyEncodedURI(string requestUrl, string expectedUrl)
public async Task BatchRequestContent_AddBatchRequestPutStepWithBaseRequestProperlyEncodedURIAsync(string requestUrl, string expectedUrl)
{
// Arrange
BatchRequestStep batchRequestStep = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Put, requestUrl));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public async Task BatchResponseContent_GetResponseStreamByIdAsync()


[Fact]
public async Task BatchResponseContent_GetResponseByIdAsyncWithDeseirializer()
public async Task BatchResponseContent_GetResponseByIdAsyncWithDeseirializerAsync()
{
// Arrange
string responseJSON = "{\"responses\":"
Expand Down Expand Up @@ -295,7 +295,7 @@ public async Task BatchResponseContent_GetResponseByIdAsyncWithDeseirializer()
}

[Fact]
public async Task BatchResponseContent_GetResponseByIdAsyncWithDeserializerWorksWithDateTimeOffsets()
public async Task BatchResponseContent_GetResponseByIdAsyncWithDeserializerWorksWithDateTimeOffsetsAsync()
{
// Arrange an example Event object with a few properties
string responseJSON = "\n{\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void CreateClient_WithHandlers()
}

[Fact]
public async Task SendRequest_Redirect()
public async Task SendRequest_RedirectAsync()
{
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, "http://example.org/foo");
var redirectResponse = new HttpResponseMessage(HttpStatusCode.MovedPermanently);
Expand All @@ -218,7 +218,7 @@ public async Task SendRequest_Redirect()
}

[Fact]
public async Task SendRequest_Retry()
public async Task SendRequest_RetryAsync()
{
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, "http://example.org/foo");
httpRequestMessage.Content = new StringContent("Hello World");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public TelemetryHandlerTests()
}

[Fact]
public async Task TelemetryHandlerShouldSetTelemetryHeaderWithDefaults()
public async Task TelemetryHandlerShouldSetTelemetryHeaderWithDefaultsAsync()
{
var configuredTelemetryHandler = new GraphTelemetryHandler();
configuredTelemetryHandler.InnerHandler = new FakeSuccessHandler();
Expand Down Expand Up @@ -56,7 +56,7 @@ public async Task TelemetryHandlerShouldSetTelemetryHeaderWithDefaults()
}

[Fact]
public async Task TelemetryHandlerShouldSetTelemetryHeaderWithCustomConfiguration()
public async Task TelemetryHandlerShouldSetTelemetryHeaderWithCustomConfigurationAsync()
{
var clientOptions = new GraphClientOptions
{
Expand Down
Loading