diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Extensions/IDecryptableContentExtensionsTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Extensions/IDecryptableContentExtensionsTests.cs
index 1dc6d9ac..7c59b644 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Extensions/IDecryptableContentExtensionsTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Extensions/IDecryptableContentExtensionsTests.cs
@@ -64,7 +64,7 @@ public IDecryptableContentExtensionsTests()
}
[Fact]
- public async Task DecryptableContentCanBeDecryptedWithCertificate()
+ public async Task DecryptableContentCanBeDecryptedWithCertificateAsync()
{
// Arrange
var testChangeNotificationEncryptedContent = new TestChangeNotificationEncryptedContent
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Microsoft.Graph.DotnetCore.Core.Test.csproj b/tests/Microsoft.Graph.DotnetCore.Core.Test/Microsoft.Graph.DotnetCore.Core.Test.csproj
index 2648c23f..7613ef2d 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Microsoft.Graph.DotnetCore.Core.Test.csproj
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Microsoft.Graph.DotnetCore.Core.Test.csproj
@@ -5,7 +5,6 @@
false
false
latest
- CS0618
@@ -35,6 +34,10 @@
all
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Mocks/MockCompressedContent.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Mocks/MockCompressedContent.cs
deleted file mode 100644
index 82ca3992..00000000
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Mocks/MockCompressedContent.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// ------------------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
-// ------------------------------------------------------------------------------
-
-namespace Microsoft.Graph.DotnetCore.Core.Test.Mocks
-{
- using System.Collections.Generic;
- using System.IO;
- using System.IO.Compression;
- using System.Net;
- using System.Net.Http;
- using System.Threading.Tasks;
-
- public class MockCompressedContent : HttpContent
- {
- private readonly HttpContent originalContent;
-
- public MockCompressedContent(HttpContent httpContent)
- {
- originalContent = httpContent;
-
- foreach (KeyValuePair> header in originalContent.Headers)
- Headers.TryAddWithoutValidation(header.Key, header.Value);
- }
-
- protected override Task SerializeToStreamAsync(Stream stream, TransportContext context)
- {
- Stream compressedStream = new GZipStream(stream, CompressionMode.Compress, true);
-
- return originalContent.CopyToAsync(compressedStream).ContinueWith(t =>
- {
- if (compressedStream != null)
- {
- compressedStream.Dispose();
- }
- });
- }
-
- protected override bool TryComputeLength(out long length)
- {
- length = -1;
- return false;
- }
- }
-}
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/AsyncMonitorTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/AsyncMonitorTests.cs
index 52f2ab07..389c2252 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/AsyncMonitorTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/AsyncMonitorTests.cs
@@ -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(
@@ -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(), It.IsAny>>(), It.IsAny()))
@@ -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(), It.IsAny>>(), It.IsAny()))
@@ -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(), It.IsAny>>(), It.IsAny()))
@@ -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(), It.IsAny>>(), It.IsAny()))
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/BatchRequestBuilderTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/BatchRequestBuilderTests.cs
index 4f7f5827..f9e84964 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/BatchRequestBuilderTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/BatchRequestBuilderTests.cs
@@ -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
namespace Microsoft.Graph.DotnetCore.Core.Test.Requests
{
using System.Collections.Generic;
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Content/BatchRequestContentTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Content/BatchRequestContentTests.cs
index cc43d0d5..1333e57b 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Content/BatchRequestContentTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Content/BatchRequestContentTests.cs
@@ -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
namespace Microsoft.Graph.DotnetCore.Core.Test.Requests.Content
{
using System;
@@ -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();
@@ -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();
@@ -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();
@@ -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));
@@ -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
@@ -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 { "1" });
@@ -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 };
@@ -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);
@@ -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);
@@ -623,7 +624,7 @@ public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestToBatchR
[InlineData("https://graph.microsoft.com/beta/users/abcbeta123@wonderemail.com/events", "/users/abcbeta123@wonderemail.com/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'**bobbetancourt@fakeemail.com**')", "/users?$filter=identities/any(id:id/issuer eq '$74707853-18b3-411f-ad57-2ef65f6fdeb0' and id/issuerAssignedId eq '**bobbetancourt@fakeemail.com**')")]
[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'**bobbetancourt@fakeemail.com**')&$top=1", "/users?$filter=identities/any(id:id/issuer eq '$74707853-18b3-411f-ad57-2ef65f6fdeb0' and id/issuerAssignedId eq '**bobbetancourt@fakeemail.com**')&$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));
@@ -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));
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Content/BatchResponseContentTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Content/BatchResponseContentTests.cs
index 90bfc84f..edd67d9f 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Content/BatchResponseContentTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Content/BatchResponseContentTests.cs
@@ -229,7 +229,7 @@ public async Task BatchResponseContent_GetResponseStreamByIdAsync()
[Fact]
- public async Task BatchResponseContent_GetResponseByIdAsyncWithDeseirializer()
+ public async Task BatchResponseContent_GetResponseByIdAsyncWithDeseirializerAsync()
{
// Arrange
string responseJSON = "{\"responses\":"
@@ -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" +
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/GraphClientFactoryTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/GraphClientFactoryTests.cs
index bddc8d61..2f547dff 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/GraphClientFactoryTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/GraphClientFactoryTests.cs
@@ -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);
@@ -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");
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Middleware/TelemetryHandlerTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Middleware/TelemetryHandlerTests.cs
index db5b2af0..19425a9c 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Middleware/TelemetryHandlerTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Middleware/TelemetryHandlerTests.cs
@@ -24,7 +24,7 @@ public TelemetryHandlerTests()
}
[Fact]
- public async Task TelemetryHandlerShouldSetTelemetryHeaderWithDefaults()
+ public async Task TelemetryHandlerShouldSetTelemetryHeaderWithDefaultsAsync()
{
var configuredTelemetryHandler = new GraphTelemetryHandler();
configuredTelemetryHandler.InnerHandler = new FakeSuccessHandler();
@@ -56,7 +56,7 @@ public async Task TelemetryHandlerShouldSetTelemetryHeaderWithDefaults()
}
[Fact]
- public async Task TelemetryHandlerShouldSetTelemetryHeaderWithCustomConfiguration()
+ public async Task TelemetryHandlerShouldSetTelemetryHeaderWithCustomConfigurationAsync()
{
var clientOptions = new GraphClientOptions
{
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/ResponseHandlerTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/ResponseHandlerTests.cs
index a373a346..4e62e02d 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/ResponseHandlerTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/ResponseHandlerTests.cs
@@ -27,7 +27,7 @@ public ResponseHandlerTests()
}
[Fact]
- public async Task HandleUserResponse()
+ public async Task HandleUserResponseAsync()
{
// Arrange
var responseHandler = new ResponseHandler();
@@ -57,7 +57,7 @@ public async Task HandleUserResponse()
///
///
[Fact]
- public async Task HandleEventDeltaResponseWithArrayOfPrimitives()
+ public async Task HandleEventDeltaResponseWithArrayOfPrimitivesAsync()
{
// Arrange
var deltaResponseHandler = new DeltaResponseHandler();
@@ -99,7 +99,7 @@ public async Task HandleEventDeltaResponseWithArrayOfPrimitives()
}
[Fact]
- public async Task HandleEventDeltaResponse()
+ public async Task HandleEventDeltaResponseAsync()
{
// Arrange
var deltaResponseHandler = new DeltaResponseHandler();
@@ -144,7 +144,7 @@ public async Task HandleEventDeltaResponse()
///
///
[Fact]
- public async Task HandleEventDeltaResponseWithEmptyCollectionPage()
+ public async Task HandleEventDeltaResponseWithEmptyCollectionPageAsync()
{
// Arrange
var deltaResponseHandler = new DeltaResponseHandler();
@@ -175,7 +175,7 @@ public async Task HandleEventDeltaResponseWithEmptyCollectionPage()
}
[Fact]
- public async Task HandleEventDeltaResponseWithNullValues()
+ public async Task HandleEventDeltaResponseWithNullValuesAsync()
{
// Arrange
var deltaResponseHandler = new DeltaResponseHandler();
@@ -210,7 +210,7 @@ public async Task HandleEventDeltaResponseWithNullValues()
var deltaServiceLibResponse = await deltaResponseHandler.HandleResponseAsync(hrm, null);
var eventsDeltaCollectionPage = deltaServiceLibResponse.Value;
eventsDeltaCollectionPage[0].AdditionalData.TryGetValue("changes", out object changes);
- var changeList = JsonSerializer.Deserialize>(KiotaJsonSerializer.SerializeAsString(changes as UntypedArray));
+ var changeList = JsonSerializer.Deserialize>(await KiotaJsonSerializer.SerializeAsStringAsync(changes as UntypedArray));
// Updating a non-schematized property on a model such as instance annotations, open types,
// and schema extensions. We can assume that a customer's model would not use a dictionary.
@@ -288,7 +288,7 @@ public async Task HandleEventDeltaResponseWithNullValues()
///
///
[Fact]
- public async Task HandleEventDeltaResponseWithRemovedItem()
+ public async Task HandleEventDeltaResponseWithRemovedItemAsync()
{
// Arrange
var deltaResponseHandler = new DeltaResponseHandler();
@@ -307,14 +307,14 @@ public async Task HandleEventDeltaResponseWithRemovedItem()
var deltaServiceLibResponse = await deltaResponseHandler.HandleResponseAsync(hrm, null);
var eventsDeltaCollectionPage = deltaServiceLibResponse.Value;
eventsDeltaCollectionPage[0].AdditionalData.TryGetValue("changes", out object changes);
- var changeList = JsonSerializer.Deserialize>(KiotaJsonSerializer.SerializeAsString(changes as UntypedArray));
+ var changeList = JsonSerializer.Deserialize>(await KiotaJsonSerializer.SerializeAsStringAsync(changes as UntypedArray));
// Assert
Assert.True(changeList.Exists(x => x.Equals("@removed.reason")));
}
[Fact]
- public async Task HandleEventDeltaResponseWithEmptyCollectionProperty()
+ public async Task HandleEventDeltaResponseWithEmptyCollectionPropertyAsync()
{
// Arrange
var deltaResponseHandler = new DeltaResponseHandler();
@@ -342,7 +342,7 @@ public async Task HandleEventDeltaResponseWithEmptyCollectionProperty()
Assert.True(deltaServiceLibResponse.Value[0].AdditionalData.TryGetValue("changes", out object changesElement)); // The first element has a list of changes
// Deserialize the change list to a list of strings
- var firstItemChangeList = JsonSerializer.Deserialize>(KiotaJsonSerializer.SerializeAsString(changesElement as UntypedNode));
+ var firstItemChangeList = JsonSerializer.Deserialize>(await KiotaJsonSerializer.SerializeAsStringAsync(changesElement as UntypedNode));
Assert.NotNull(firstItemChangeList);
Assert.NotEmpty(firstItemChangeList);
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Upload/UploadResponseHandlerTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Upload/UploadResponseHandlerTests.cs
index 1cfff186..6480ebd5 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Upload/UploadResponseHandlerTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Requests/Upload/UploadResponseHandlerTests.cs
@@ -26,7 +26,7 @@ public UploadResponseHandlerTests()
[Theory]
[InlineData(HttpStatusCode.Created)]
[InlineData(HttpStatusCode.OK)]
- public async Task GetDriveItemOnCompletedUpload(HttpStatusCode statusCode)
+ public async Task GetDriveItemOnCompletedUploadAsync(HttpStatusCode statusCode)
{
// Arrange
var responseHandler = new UploadResponseHandler();
@@ -53,7 +53,7 @@ public async Task GetDriveItemOnCompletedUpload(HttpStatusCode statusCode)
}
[Fact]
- public async Task GetFileAttachmentLocationItemOnCompletedUpload()
+ public async Task GetFileAttachmentLocationItemOnCompletedUploadAsync()
{
// Arrange
var responseHandler = new UploadResponseHandler();
@@ -75,7 +75,7 @@ public async Task GetFileAttachmentLocationItemOnCompletedUpload()
}
[Fact]
- public async Task GetUploadSessionOnProgressingUpload()
+ public async Task GetUploadSessionOnProgressingUploadAsync()
{
// Arrange
var responseHandler = new UploadResponseHandler();
@@ -106,7 +106,7 @@ public async Task GetUploadSessionOnProgressingUpload()
}
[Fact]
- public async Task ThrowsServiceExceptionOnErrorResponse()
+ public async Task ThrowsServiceExceptionOnErrorResponseAsync()
{
// Arrange
var responseHandler = new UploadResponseHandler();
@@ -135,7 +135,7 @@ public async Task ThrowsServiceExceptionOnErrorResponse()
}
[Fact]
- public async Task ThrowsSerializationErrorOnInvalidJson()
+ public async Task ThrowsSerializationErrorOnInvalidJsonAsync()
{
// Arrange
var responseHandler = new UploadResponseHandler();
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Serialization/SerializerTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Serialization/SerializerTests.cs
index c6935d9d..09a167dc 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Serialization/SerializerTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Serialization/SerializerTests.cs
@@ -2,6 +2,8 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
+
+
namespace Microsoft.Graph.DotnetCore.Core.Test.Serialization
{
using System;
@@ -9,6 +11,7 @@ namespace Microsoft.Graph.DotnetCore.Core.Test.Serialization
using System.IO;
using System.Linq;
using System.Text;
+ using System.Threading.Tasks;
using Microsoft.Graph.Core.Models;
using Microsoft.Graph.DotnetCore.Core.Test.TestModels;
using Microsoft.Graph.DotnetCore.Core.Test.TestModels.ServiceModels;
@@ -25,7 +28,7 @@ public SerializerTests()
}
[Fact]
- public void DeserializeDerivedType()
+ public async Task DeserializeDerivedTypeAsync()
{
var id = "id";
var name = "name";
@@ -35,7 +38,7 @@ public void DeserializeDerivedType()
id,
name);
- var derivedType = KiotaJsonSerializer.Deserialize(stringToDeserialize);
+ var derivedType = await KiotaJsonSerializer.DeserializeAsync(stringToDeserialize);
Assert.NotNull(derivedType);
Assert.Equal(id, derivedType.Id);
@@ -43,7 +46,7 @@ public void DeserializeDerivedType()
}
[Fact]
- public void DeserializeDerivedTypeFromAbstractParent()
+ public async Task DeserializeDerivedTypeFromAbstractParentAsync()
{
var id = "id";
var name = "name";
@@ -54,7 +57,7 @@ public void DeserializeDerivedTypeFromAbstractParent()
name);
//The type information from "@odata.type" should lead to correctly deserializing to the derived type
- var derivedType = KiotaJsonSerializer.Deserialize(stringToDeserialize) as DerivedTypeClass;
+ var derivedType = await KiotaJsonSerializer.DeserializeAsync(stringToDeserialize) as DerivedTypeClass;
Assert.NotNull(derivedType);
Assert.Equal(id, derivedType.Id);
@@ -63,7 +66,7 @@ public void DeserializeDerivedTypeFromAbstractParent()
[Fact]
- public void DeserializeInvalidODataType()
+ public async Task DeserializeInvalidODataTypeAsync()
{
var id = "id";
var givenName = "name";
@@ -73,7 +76,7 @@ public void DeserializeInvalidODataType()
id,
givenName);
- var instance = KiotaJsonSerializer.Deserialize(stringToDeserialize);
+ var instance = await KiotaJsonSerializer.DeserializeAsync(stringToDeserialize);
Assert.NotNull(instance);
Assert.Equal(id, instance.Id);
@@ -82,7 +85,7 @@ public void DeserializeInvalidODataType()
}
[Fact]
- public void DeserializerFollowsNamingProperty()
+ public async Task DeserializerFollowsNamingPropertyAsync()
{
var id = "id";
var givenName = "name";
@@ -94,7 +97,7 @@ public void DeserializerFollowsNamingProperty()
givenName,
link);
- var instance = KiotaJsonSerializer.Deserialize(stringToDeserialize);
+ var instance = await KiotaJsonSerializer.DeserializeAsync(stringToDeserialize);
Assert.NotNull(instance);
Assert.Equal(id, instance.Id);
@@ -104,7 +107,7 @@ public void DeserializerFollowsNamingProperty()
}
[Fact]
- public void DeserializeUnknownEnumValue()
+ public async Task DeserializeUnknownEnumValueAsync()
{
var enumValue = "newValue";
var id = "id";
@@ -114,7 +117,7 @@ public void DeserializeUnknownEnumValue()
enumValue,
id);
- var instance = KiotaJsonSerializer.Deserialize(stringToDeserialize);
+ var instance = await KiotaJsonSerializer.DeserializeAsync(stringToDeserialize);
Assert.NotNull(instance);
Assert.Equal(id, instance.Id);
@@ -123,14 +126,14 @@ public void DeserializeUnknownEnumValue()
}
[Fact]
- public void DeserializeDateEnumerableValue()
+ public async Task DeserializeDateEnumerableValueAsync()
{
var now = DateTimeOffset.UtcNow;
var tomorrow = now.AddDays(1);
var stringToDeserialize = string.Format("{{\"dateCollection\":[\"{0}\",\"{1}\"]}}", now.ToString("yyyy-MM-dd"), tomorrow.ToString("yyyy-MM-dd"));
- var deserializedObject = KiotaJsonSerializer.Deserialize(stringToDeserialize);
+ var deserializedObject = await KiotaJsonSerializer.DeserializeAsync(stringToDeserialize);
Assert.Equal(2, deserializedObject.DateCollection.Count());
Assert.True(deserializedObject.DateCollection.Any(
@@ -148,7 +151,7 @@ public void DeserializeDateEnumerableValue()
[Fact]
- public void DeserializeMemorableDatesValue()
+ public async Task DeserializeMemorableDatesValueAsync()
{
var now = DateTimeOffset.UtcNow;
var tomorrow = now.AddDays(1);
@@ -167,7 +170,7 @@ public void DeserializeMemorableDatesValue()
// Serialize
var serializedStream = KiotaJsonSerializer.SerializeAsStream(derivedTypeInstance);
// De serialize
- var deserializedInstance = KiotaJsonSerializer.Deserialize(serializedStream);
+ var deserializedInstance = await KiotaJsonSerializer.DeserializeAsync(serializedStream);
Assert.Equal(derivedTypeInstance.Name, deserializedInstance.Name);
Assert.Equal(derivedTypeInstance.Id, deserializedInstance.Id);
@@ -175,13 +178,13 @@ public void DeserializeMemorableDatesValue()
}
[Fact]
- public void DeserializeDateValue()
+ public async Task DeserializeDateValueAsync()
{
var now = DateTimeOffset.UtcNow;
var stringToDeserialize = string.Format("{{\"nullableDate\":\"{0}\"}}", now.ToString("yyyy-MM-dd"));
- var dateClass = KiotaJsonSerializer.Deserialize(stringToDeserialize);
+ var dateClass = await KiotaJsonSerializer.DeserializeAsync(stringToDeserialize);
Assert.Equal(now.Year, dateClass.NullableDate.Value.Year);
Assert.Equal(now.Month, dateClass.NullableDate.Value.Month);
@@ -192,7 +195,7 @@ public void DeserializeDateValue()
// This test validates we do not experience an InvalidCastException in scenarios where the api could return a type in the odata.type string the is not assignable to the type defined in the metadata.
// A good example is the ResourceData type which can have the odata.type specified as ChatMessage(which derives from entity) and can't be assigned to it. Extra properties will therefore be found in AdditionalData.
// https://docs.microsoft.com/en-us/graph/api/resources/resourcedata?view=graph-rest-1.0#json-representation
- public void DeserializeUnrelatedTypesInOdataType()
+ public async Task DeserializeUnrelatedTypesInOdataTypeAsync()
{
// Arrange
var resourceDataString = "{\r\n" +
@@ -203,7 +206,7 @@ public void DeserializeUnrelatedTypesInOdataType()
"}";
// Act
- var resourceData = KiotaJsonSerializer.Deserialize(resourceDataString);
+ var resourceData = await KiotaJsonSerializer.DeserializeAsync(resourceDataString);
// Assert
Assert.IsType(resourceData);
@@ -215,7 +218,7 @@ public void DeserializeUnrelatedTypesInOdataType()
}
[Fact]
- public void NewAbstractDerivedClassInstance()
+ public async Task NewAbstractDerivedClassInstanceAsync()
{
var entityId = "entityId";
var additionalKey = "key";
@@ -227,7 +230,7 @@ public void NewAbstractDerivedClassInstance()
additionalKey,
additionalValue);
- var instance = KiotaJsonSerializer.Deserialize(stringToDeserialize);
+ var instance = await KiotaJsonSerializer.DeserializeAsync(stringToDeserialize);
Assert.NotNull(instance);
Assert.Equal(entityId, instance.Id);
@@ -236,7 +239,7 @@ public void NewAbstractDerivedClassInstance()
}
[Fact]
- public void SerializeAndDeserializeKnownEnumValue()
+ public async Task SerializeAndDeserializeKnownEnumValueAsync()
{
var instance = new DerivedTypeClass
{
@@ -251,15 +254,13 @@ public void SerializeAndDeserializeKnownEnumValue()
// Serialize
- var serializedStream = KiotaJsonSerializer.SerializeAsStream(instance);
+ var serializeAsString = await KiotaJsonSerializer.SerializeAsStringAsync(instance);
//Assert
- var streamReader = new StreamReader(serializedStream);
- Assert.Equal(expectedSerializedStream, streamReader.ReadToEnd());
+ Assert.Equal(expectedSerializedStream, serializeAsString);
// De serialize
- serializedStream.Position = 0; //reset the stream to be read again
- var newInstance = KiotaJsonSerializer.Deserialize(serializedStream);
+ var newInstance = await KiotaJsonSerializer.DeserializeAsync(serializeAsString);
Assert.NotNull(newInstance);
Assert.Equal(instance.Id, instance.Id);
@@ -324,7 +325,7 @@ public void SerializeDateNullValue()
}
[Fact]
- public void SerializeDateValue()
+ public async Task SerializeDateValueAsync()
{
var now = DateTimeOffset.UtcNow;
@@ -335,16 +336,14 @@ public void SerializeDateValue()
NullableDate = new Date(now.Year, now.Month, now.Day),
};
- using var jsonSerializerWriter = new JsonSerializationWriter();
- jsonSerializerWriter.WriteObjectValue(string.Empty, date);
- var serializedString = KiotaJsonSerializer.SerializeAsString(date);
+ var serializedString = await KiotaJsonSerializer.SerializeAsStringAsync(date);
// Assert
Assert.Equal(expectedSerializedString, serializedString);
}
[Fact]
- public void DerivedTypeConverterIgnoresPropertyWithJsonIgnore()
+ public async Task DerivedTypeConverterIgnoresPropertyWithJsonIgnoreAsync()
{
var now = DateTimeOffset.UtcNow;
@@ -357,14 +356,14 @@ public void DerivedTypeConverterIgnoresPropertyWithJsonIgnore()
};
// Assert
- var serializedString = KiotaJsonSerializer.SerializeAsString(date);
+ var serializedString = await KiotaJsonSerializer.SerializeAsStringAsync(date);
Assert.Equal(expectedSerializedString, serializedString);
Assert.DoesNotContain("230", serializedString);
}
[Fact]
- public void SerializeObjectWithAdditionalDataWithDerivedTypeConverter()
+ public async Task SerializeObjectWithAdditionalDataWithDerivedTypeConverterAsync()
{
// This example class uses the derived type converter
// Arrange
@@ -387,13 +386,13 @@ public void SerializeObjectWithAdditionalDataWithDerivedTypeConverter()
"}";
// Act
- var serializedJsonString = KiotaJsonSerializer.SerializeAsString(testItemBody);
+ var serializedJsonString = await KiotaJsonSerializer.SerializeAsStringAsync(testItemBody);
// Assert
Assert.Equal(expectedSerializedString, serializedJsonString);
}
[Fact]
- public void SerializeObjectWithEmptyAdditionalData()
+ public async Task SerializeObjectWithEmptyAdditionalDataAsync()
{
// This example class uses the derived type converter with an empty/unset AdditionalData
// Arrange
@@ -409,7 +408,7 @@ public void SerializeObjectWithEmptyAdditionalData()
"}";
// Act
- var serializedString = KiotaJsonSerializer.SerializeAsString(testItemBody);
+ var serializedString = await KiotaJsonSerializer.SerializeAsStringAsync(testItemBody);
//Assert
Assert.Equal(expectedSerializedString, serializedString);
@@ -417,7 +416,7 @@ public void SerializeObjectWithEmptyAdditionalData()
}
[Fact]
- public void SerializeObjectWithAdditionalDataWithoutDerivedTypeConverter()
+ public async Task SerializeObjectWithAdditionalDataWithoutDerivedTypeConverterAsync()
{
// This example class does NOT use the derived type converter to act as a control
// Arrange
@@ -439,7 +438,7 @@ public void SerializeObjectWithAdditionalDataWithoutDerivedTypeConverter()
// Act
// Assert
- var serializedJsonString = KiotaJsonSerializer.SerializeAsString(testEmailAddress);
+ var serializedJsonString = await KiotaJsonSerializer.SerializeAsStringAsync(testEmailAddress);
Assert.Equal(expectedSerializedString, serializedJsonString);
}
@@ -463,7 +462,7 @@ public void SerializeDateTimeOffsetValue(string dateTimeOffsetString, string exp
}
[Fact]
- public void SerializeUploadSessionValues()
+ public async Task SerializeUploadSessionValuesAsync()
{
// Arrange
var uploadSession = new UploadSession()
@@ -475,17 +474,17 @@ public void SerializeUploadSessionValues()
var expectedString = @"{""expirationDateTime"":""2016-11-20T18:23:45.9356913+00:00"",""nextExpectedRanges"":[""0 - 1000""],""uploadUrl"":""http://localhost""}";
// Act
// Assert
- var serializedJsonString = KiotaJsonSerializer.SerializeAsString(uploadSession);
+ var serializedJsonString = await KiotaJsonSerializer.SerializeAsStringAsync(uploadSession);
// Expect the string to be ISO 8601-1:2019 format
Assert.Equal(expectedString, serializedJsonString);
}
[Fact]
- public void DeserializeUploadSessionValues()
+ public async Task DeserializeUploadSessionValuesAsync()
{
// Act 1
const string camelCasedPayload = @"{""expirationDateTime"":""2016-11-20T18:23:45.9356913+00:00"",""nextExpectedRanges"":[""0 - 1000""],""uploadUrl"":""http://localhost""}";
- var uploadSession = KiotaJsonSerializer.Deserialize(camelCasedPayload);
+ var uploadSession = await KiotaJsonSerializer.DeserializeAsync(camelCasedPayload);
Assert.NotNull(uploadSession);
Assert.NotNull(uploadSession.ExpirationDateTime);
Assert.NotNull(uploadSession.NextExpectedRanges);
@@ -493,7 +492,7 @@ public void DeserializeUploadSessionValues()
// Act 1
const string pascalCasedPayload = @"{""ExpirationDateTime"":""2016-11-20T18:23:45.9356913+00:00"",""NextExpectedRanges"":[""0 - 1000""],""uploadUrl"":""http://localhost""}";
- var uploadSession2 = KiotaJsonSerializer.Deserialize(pascalCasedPayload);
+ var uploadSession2 = await KiotaJsonSerializer.DeserializeAsync(pascalCasedPayload);
Assert.NotNull(uploadSession2);
Assert.NotNull(uploadSession2.ExpirationDateTime);
Assert.NotNull(uploadSession2.NextExpectedRanges);
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Tasks/LargeFileUploadTaskTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Tasks/LargeFileUploadTaskTests.cs
index 0de4840d..745d626b 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Tasks/LargeFileUploadTaskTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Tasks/LargeFileUploadTaskTests.cs
@@ -142,7 +142,7 @@ public void BreaksDownStreamIntoRangesCorrectly()
}
[Fact]
- public async Task HandlesCancellationToken()
+ public async Task HandlesCancellationTokenAsync()
{
byte[] mockData = new byte[1000000];//create a stream of about 1M so we can split it into a few 320K slices
var requestUrl = "https://localhost/";
diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Tasks/PageIteratorTests.cs b/tests/Microsoft.Graph.DotnetCore.Core.Test/Tasks/PageIteratorTests.cs
index 983615cb..9becee06 100644
--- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Tasks/PageIteratorTests.cs
+++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Tasks/PageIteratorTests.cs
@@ -67,7 +67,7 @@ public void Given_Null_Delegate_It_Throws_ArgumentNullException()
}
[Fact]
- public async Task Given_Concrete_Generated_CollectionPage_It_Iterates_Page_Items()
+ public async Task Given_Concrete_Generated_CollectionPage_It_Iterates_Page_ItemsAsync()
{
// Arrange the sample first page
var inputEventCount = 17;
@@ -95,7 +95,7 @@ public async Task Given_Concrete_Generated_CollectionPage_It_Iterates_Page_Items
}
[Fact]
- public async Task Given_Concrete_Generated_CollectionPage_It_Stops_Iterating_Page_Items()
+ public async Task Given_Concrete_Generated_CollectionPage_It_Stops_Iterating_Page_ItemsAsync()
{
// Arrange the sample first page
var inputEventCount = 10;
@@ -125,7 +125,7 @@ public async Task Given_Concrete_Generated_CollectionPage_It_Stops_Iterating_Pag
}
[Fact]
- public async Task Given_CollectionPage_It_Stops_Iterating_Across_Pages()
+ public async Task Given_CollectionPage_It_Stops_Iterating_Across_PagesAsync()
{
// Arrange the sample first page
// Create the 17 events to initialize the original collection page.
@@ -173,7 +173,7 @@ public async Task Given_CollectionPage_It_Stops_Iterating_Across_Pages()
}
[Fact]
- public async Task Given_CollectionPage_Without_Next_Link_Property_It_Iterates_Across_Pages()
+ public async Task Given_CollectionPage_Without_Next_Link_Property_It_Iterates_Across_PagesAsync()
{
// // Arrange the sample first page of 17 events to initialize the original collection page.
var originalPage = new TestEventsDeltaResponse() { Value = new List() };
@@ -220,7 +220,7 @@ public async Task Given_CollectionPage_Without_Next_Link_Property_It_Iterates_Ac
}
[Fact]
- public async Task Given_CollectionPage_Delta_Link_Property_It_Iterates_Across_Pages()
+ public async Task Given_CollectionPage_Delta_Link_Property_It_Iterates_Across_PagesAsync()
{
// // Arrange the sample first page of 17 events to initialize the original collection page.
var originalPage = new TestEventsDeltaResponse() { Value = new List() };
@@ -243,7 +243,7 @@ public async Task Given_CollectionPage_Delta_Link_Property_It_Iterates_Across_Pa
}
[Fact]
- public async Task Given_CollectionPage_Delta_Link_Property_It_Iterates_Across_Pages_And_Resumes()
+ public async Task Given_CollectionPage_Delta_Link_Property_It_Iterates_Across_Pages_And_ResumesAsync()
{
// // Arrange the sample first page of 17 events to initialize the original collection page.
var eventBag = new List();
@@ -307,7 +307,7 @@ public async Task Given_CollectionPage_Delta_Link_Property_It_Iterates_Across_Pa
}
[Fact]
- public async Task Given_CollectionPage_It_Iterates_Across_Pages_With_Async_Delegate()
+ public async Task Given_CollectionPage_It_Iterates_Across_Pages_With_Async_DelegateAsync()
{
// // Arrange the sample first page of 17 events to initialize the original collection page.
var originalPage = new TestEventsResponse() { Value = new List(), OdataNextLink = "http://localhost/events?$skip=11" };
@@ -355,7 +355,7 @@ public async Task Given_CollectionPage_It_Iterates_Across_Pages_With_Async_Deleg
}
[Fact]
- public async Task Given_CollectionPage_It_Iterates_Across_Pages()
+ public async Task Given_CollectionPage_It_Iterates_Across_PagesAsync()
{
// // Arrange the sample first page of 17 events to initialize the original collection page.
var originalPage = new TestEventsResponse() { Value = new List(), OdataNextLink = "http://localhost/events?$skip=11" };
@@ -402,7 +402,7 @@ public async Task Given_CollectionPage_It_Iterates_Across_Pages()
}
[Fact]
- public async Task Given_ApiError_It_Shows_Helpful_Message()
+ public async Task Given_ApiError_It_Shows_Helpful_MessageAsync()
{
// // Arrange the sample first page of 17 events to initialize the original collection page.
var originalPage = new TestEventsResponse() { Value = new List(), OdataNextLink = "http://localhost/events?$skip=11" };
@@ -454,7 +454,7 @@ public async Task Given_ApiError_It_Shows_Helpful_Message()
}
[Fact]
- public async Task Given_CollectionPage_It_Detects_Next_Link_Loop()
+ public async Task Given_CollectionPage_It_Detects_Next_Link_LoopAsync()
{
// Create the 17 events to initialize the original collection page.
var originalPage = new TestEventsResponse() { Value = new List(), OdataNextLink = "http://localhost/events?$skip=11" };
@@ -490,7 +490,7 @@ public async Task Given_CollectionPage_It_Detects_Next_Link_Loop()
}
[Fact]
- public async Task Given_CollectionPage_It_Handles_Empty_NextPage()
+ public async Task Given_CollectionPage_It_Handles_Empty_NextPageAsync()
{
try
{
@@ -540,7 +540,7 @@ public void Given_PageIterator_It_Has_PagingState_NotStarted()
}
[Fact]
- public async Task Given_RequestConfigurator_It_Is_Invoked()
+ public async Task Given_RequestConfigurator_It_Is_InvokedAsync()
{
// Create the 17 events to initialize the original collection page.
var originalPage = new TestEventsResponse() { Value = new List(), OdataNextLink = "http://localhost/events?$skip=11" };