private static async Task TestBatch(HttpClient httpClient) { Console.WriteLine("Fetching Batch"); // Create http GET request. HttpRequestMessage httpRequestMessage1 = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/me/"); // Create http POST request. String jsonContent = "{" + "\"displayName\": \"My Notebook2\"" + "}"; HttpRequestMessage httpRequestMessage2 = new HttpRequestMessage(HttpMethod.Post, "https://graph.microsoft.com/v1.0/me/onenote/notebooks") { Content = new StringContent(jsonContent, Encoding.UTF8, "application/json") }; // Create batch request steps with request ids. BatchRequestStep requestStep1 = new BatchRequestStep("1", httpRequestMessage1, null); BatchRequestStep requestStep2 = new BatchRequestStep("2", httpRequestMessage2, new List <string> { "1" }); // Add batch request steps to BatchRequestContent. BatchRequestContent batchRequestContent = new BatchRequestContent(); batchRequestContent.AddBatchRequestStep(requestStep1); batchRequestContent.AddBatchRequestStep(requestStep2); // Send batch request with BatchRequestContent. HttpResponseMessage response = await httpClient.PostAsync("https://graph.microsoft.com/v1.0/$batch", batchRequestContent); // Handle http responses using BatchResponseContent. BatchResponseContent batchResponseContent = new BatchResponseContent(response); Dictionary <string, HttpResponseMessage> responses = await batchResponseContent.GetResponsesAsync(); HttpResponseMessage httpResponse = await batchResponseContent.GetResponseByIdAsync("1"); string responseString = await httpResponse.Content.ReadAsStringAsync(); Console.WriteLine(responseString); HttpResponseMessage httpResponse2 = await batchResponseContent.GetResponseByIdAsync("2"); responseString = await httpResponse2.Content.ReadAsStringAsync(); Console.WriteLine(responseString); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); string nextLink = await batchResponseContent.GetNextLinkAsync(); Console.WriteLine(nextLink); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); }
public void BatchRequestContent_AddBatchRequestStepWithExistingRequestStep() { BatchRequestStep batchRequestStep = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL)); BatchRequestContent batchRequestContent = new BatchRequestContent(batchRequestStep); bool isSuccess = batchRequestContent.AddBatchRequestStep(batchRequestStep); Assert.False(isSuccess); Assert.NotNull(batchRequestContent.BatchRequestSteps); Assert.True(batchRequestContent.BatchRequestSteps.Count.Equals(1)); }
public void BatchRequestContent_InitializeWithInvalidDependsOnIds() { BatchRequestStep batchRequestStep1 = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL)); BatchRequestStep batchRequestStep2 = new BatchRequestStep("2", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL), new List <string> { "3" }); ClientException ex = Assert.Throws <ClientException>(() => new BatchRequestContent(batchRequestStep1, batchRequestStep2)); Assert.Equal(ErrorConstants.Codes.InvalidArgument, ex.Error.Code); Assert.Equal(ErrorConstants.Messages.InvalidDependsOnRequestId, ex.Error.Message); }
public void BatchRequestContent_RemoveBatchRequestStepWithIdForExistingId() { BatchRequestStep batchRequestStep1 = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL)); BatchRequestStep batchRequestStep2 = new BatchRequestStep("2", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL), new List <string> { "1" }); BatchRequestContent batchRequestContent = new BatchRequestContent(batchRequestStep1, batchRequestStep2); bool isSuccess = batchRequestContent.RemoveBatchRequestStepWithId("1"); Assert.True(isSuccess); Assert.True(batchRequestContent.BatchRequestSteps.Count.Equals(1)); Assert.True(batchRequestContent.BatchRequestSteps["2"].DependsOn.Count.Equals(0)); }
public void BatchRequestContent_AddBatchRequestStepWithNewRequestStep() { // Arrange BatchRequestStep batchRequestStep = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL)); BatchRequestContent batchRequestContent = new BatchRequestContent(); // Act Assert.False(batchRequestContent.BatchRequestSteps.Any());//Its empty bool isSuccess = batchRequestContent.AddBatchRequestStep(batchRequestStep); // Assert Assert.True(isSuccess); Assert.NotNull(batchRequestContent.BatchRequestSteps); Assert.True(batchRequestContent.BatchRequestSteps.Count.Equals(1)); }
public async static Task BatchRequestExample(GraphServiceClient graphServiceClient, int limit) { var watch = new System.Diagnostics.Stopwatch(); watch.Start(); var batchRequestContent = new BatchRequestContent(); var teams = DbOperations.GetTeams(limit); // 1. construct a Batch request for (int i = 0; i < teams.Count; i++) { var requestUrl1 = graphServiceClient.Groups[teams[i].TeamId].Drive.Root .Delta() .Request().RequestUrl; var request1 = new HttpRequestMessage(HttpMethod.Get, requestUrl1); var requestStep1 = new BatchRequestStep($"{i}", request1, null); batchRequestContent.AddBatchRequestStep(requestStep1); } //3. Submit request var batchRequest = new HttpRequestMessage(HttpMethod.Post, "https://graph.microsoft.com/v1.0/$batch"); batchRequest.Content = batchRequestContent; await graphServiceClient.AuthenticationProvider.AuthenticateRequestAsync(batchRequest); var httpClient = new HttpClient(); var batchResponse = await httpClient.SendAsync(batchRequest); // 3. Process response var batchResponseContent = new BatchResponseContent(batchResponse); var responses = await batchResponseContent.GetResponsesAsync(); foreach (var response in responses) { if (response.Value.IsSuccessStatusCode) { //Console.WriteLine(); //Console.WriteLine($"response {response.Key} - {await response.Value.Content.ReadAsStringAsync()}"); //Console.WriteLine(); Console.WriteLine($"response {response.Key}"); } } watch.Stop(); Console.WriteLine($"Checking Teams completed on {watch.ElapsedMilliseconds / 1000} seconds"); }
public async Task <string[]> GetUserIdsFromEmailAsync(string[] emails, string accessToken) { BatchRequestStep[] batchSteps = new BatchRequestStep[emails.Length]; for (int index = 0; index < emails.Length; index++) { Uri requestUri = new Uri($"https://graph.microsoft.com/v1.0/users?$filter=mail eq \'{emails[index]}\'&$select=id"); BatchRequestStep batchStep = new BatchRequestStep(index.ToString(), new HttpRequestMessage(HttpMethod.Get, requestUri)); batchSteps[index] = batchStep; } BatchRequestContent batchContent = new BatchRequestContent(batchSteps); try { var requestHeaders = AuthUtil.CreateRequestHeader(accessToken); var batchResult = await _graphClient.Batch.Request(requestHeaders).PostAsync(batchContent).ConfigureAwait(false); var batchResultContent = await batchResult.GetResponsesAsync(); var ids = new List <string>(); foreach (var item in batchResultContent.Values) { // TODO: Need to handle if each batch request http response is not 200 Users users = await item.Content.ReadAsAsync <Users>(); var targetUser = users.Value.FirstOrDefault(); if (targetUser != null) { ids.Add(targetUser.Id); } } return(ids.ToArray()); } catch (ServiceException) { // Catch Microsoft Graph SDK exception throw; } catch (Exception) { throw; } }
public void BatchRequestContent_AddBatchRequestStepToBatchRequestContentWithMaxSteps() { // Arrange BatchRequestContent batchRequestContent = new BatchRequestContent(); //Add MaxNumberOfRequests number of steps for (var i = 0; i < CoreConstants.BatchRequest.MaxNumberOfRequests; i++) { BatchRequestStep batchRequestStep = new BatchRequestStep(i.ToString(), new HttpRequestMessage(HttpMethod.Get, REQUEST_URL)); bool isSuccess = batchRequestContent.AddBatchRequestStep(batchRequestStep); Assert.True(isSuccess);//Assert we can add steps up to the max } // Act BatchRequestStep extraBatchRequestStep = new BatchRequestStep("failing_id", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL)); bool result = batchRequestContent.AddBatchRequestStep(extraBatchRequestStep); // Assert Assert.False(result);//Assert we did not add any more steps Assert.NotNull(batchRequestContent.BatchRequestSteps); Assert.True(batchRequestContent.BatchRequestSteps.Count.Equals(CoreConstants.BatchRequest.MaxNumberOfRequests)); }
public async Task JsonBatchRequest() { string token = await GetAccessTokenUsingPasswordGrant(); HttpClient httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); HttpRequestMessage httpRequestMessage1 = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/me/"); String body = "{" + "\"displayName\": \"My Notebook\"" + "}"; HttpRequestMessage httpRequestMessage2 = new HttpRequestMessage(HttpMethod.Post, "https://graph.microsoft.com/v1.0/me/onenote/notebooks"); httpRequestMessage2.Content = new StringContent(body, Encoding.UTF8, "application/json"); BatchRequestStep requestStep1 = new BatchRequestStep("1", httpRequestMessage1, null); BatchRequestStep requestStep2 = new BatchRequestStep("2", httpRequestMessage2, new List <string> { "1" }); BatchRequestContent batchRequestContent = new BatchRequestContent(); batchRequestContent.AddBatchRequestStep(requestStep1); batchRequestContent.AddBatchRequestStep(requestStep2); HttpResponseMessage response = await httpClient.PostAsync("https://graph.microsoft.com/v1.0/$batch", batchRequestContent); BatchResponseContent batchResponseContent = new BatchResponseContent(response); Dictionary <string, HttpResponseMessage> responses = await batchResponseContent.GetResponsesAsync(); HttpResponseMessage httpResponse = await batchResponseContent.GetResponseByIdAsync("1"); string nextLink = await batchResponseContent.GetNextLinkAsync(); Assert.True(responses.Count.Equals(2)); }
public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestContentFromStepAsync() { BatchRequestStep batchRequestStep1 = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL)); BatchRequestStep batchRequestStep2 = new BatchRequestStep("2", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL), new List <string> { "1" }); BatchRequestContent batchRequestContent = new BatchRequestContent(); batchRequestContent.AddBatchRequestStep(batchRequestStep1); batchRequestContent.AddBatchRequestStep(batchRequestStep2); batchRequestContent.RemoveBatchRequestStepWithId("1"); JObject requestContent = await batchRequestContent.GetBatchRequestContentAsync(); string expectedJson = "{\"requests\":[{\"id\":\"2\",\"url\":\"/me\",\"method\":\"GET\"}]}"; JObject expectedContent = JsonConvert.DeserializeObject <JObject>(expectedJson); Assert.NotNull(requestContent); Assert.True(batchRequestContent.BatchRequestSteps.Count.Equals(1)); Assert.Equal(expectedContent, requestContent); }
private static async Task AddEventsInBatch(IConfigurationRoot config, GraphServiceClient client) { var events = new List <Event>(); int maxNoBatchItems = 20; for (int i = 0; i < maxNoBatchItems * 3; i++) { var @event = new Event { Subject = "Subject" + i, Body = new ItemBody { ContentType = BodyType.Html, Content = "Content" + i }, Start = new DateTimeTimeZone { DateTime = DateTime.UtcNow.AddHours(i).ToString("yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture), TimeZone = TimeZoneInfo.Utc.Id }, End = new DateTimeTimeZone { DateTime = DateTime.UtcNow.AddHours(i).AddMinutes(30).ToString("yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture), TimeZone = TimeZoneInfo.Utc.Id }, Location = new Location { DisplayName = "Dummy location" } }; events.Add(@event); } Console.WriteLine("Creating batches..."); List <BatchRequestContent> batches = new List <BatchRequestContent>(); var batchRequestContent = new BatchRequestContent(); foreach (Event e in events) { var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, $"https://graph.microsoft.com/v1.0/users/{config["CalendarEmail"]}/events") { Content = new StringContent(JsonConvert.SerializeObject(e), Encoding.UTF8, "application/json") }; BatchRequestStep requestStep = new BatchRequestStep(events.IndexOf(e).ToString(), httpRequestMessage, null); batchRequestContent.AddBatchRequestStep(requestStep); // Max number of 20 request per batch. So we need to send out multiple batches. if (events.IndexOf(e) > 0 && events.IndexOf(e) % maxNoBatchItems == 0) { batches.Add(batchRequestContent); batchRequestContent = new BatchRequestContent(); } } if (batchRequestContent.BatchRequestSteps.Count < maxNoBatchItems) { batches.Add(batchRequestContent); } if (batches.Count == 0 && batchRequestContent != null) { batches.Add(batchRequestContent); } Console.WriteLine("Batches created. Press enter to submit them."); Console.ReadLine(); Console.WriteLine("Submitting batches..."); List <string> createdEvents = new List <string>(); foreach (BatchRequestContent batch in batches) { BatchResponseContent response = null; try { response = await client.Batch.Request().PostAsync(batch); } catch (Microsoft.Graph.ClientException ex) { Console.WriteLine(ex.Message); } Dictionary <string, HttpResponseMessage> responses = await response.GetResponsesAsync(); foreach (string key in responses.Keys) { HttpResponseMessage httpResponse = await response.GetResponseByIdAsync(key); var responseContent = await httpResponse.Content.ReadAsStringAsync(); JObject eventResponse = JObject.Parse(responseContent); var eventId = (string)eventResponse["id"]; if (eventId != null) { createdEvents.Add(eventId); } Console.WriteLine($"Response code: {responses[key].StatusCode}-{responses[key].ReasonPhrase}-{eventId}"); } } Console.WriteLine($"{events.Count} events created. Press enter to remove them from the calendar."); Console.ReadLine(); Console.WriteLine($"Removing {createdEvents.Count} events..."); foreach (string eventId in createdEvents) { if (eventId != null) { await client.Users[config["CalendarEmail"]].Events[eventId] .Request() .DeleteAsync(); } } Console.WriteLine($"{createdEvents.Count} events where removed from calendar."); }
public async static Task WatchTeamSite(IList <string> keys) { try { //var watch = new System.Diagnostics.Stopwatch(); //watch.Start(); var batchRequestContent = new BatchRequestContent(); // 1. construct a Batch request foreach (var key in keys) { if (teamSitesDeltaLinks[key] == null) { teamSitesDeltaLinks[key] = new DeltaLinks() { LastSyncDate = DateTime.UtcNow.Ticks / 100000000, DeltaLink = graphClient.Groups[key].Drive.Root .Delta() .Request() .RequestUrl + "?$select=CreatedDateTime,Deleted,File,Folder,LastModifiedDateTime,Root,SharepointIds,Size,WebUrl" } } ; var request = new HttpRequestMessage(HttpMethod.Get, teamSitesDeltaLinks[key].DeltaLink); var requestStep = new BatchRequestStep($"{key}", request, null); batchRequestContent.AddBatchRequestStep(requestStep); } //3. Submit request var batchRequest = new HttpRequestMessage(HttpMethod.Post, "https://graph.microsoft.com/v1.0/$batch"); batchRequest.Content = batchRequestContent; await graphClient.AuthenticationProvider.AuthenticateRequestAsync(batchRequest); var httpClient = new HttpClient(); var batchResponse = await httpClient.SendAsync(batchRequest); // 3. Process response var batchResponseContent = new BatchResponseContent(batchResponse); var responses = await batchResponseContent.GetResponsesAsync(); foreach (var response in responses) { if (!response.Value.IsSuccessStatusCode) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Issue on response {response.Value}"); Console.ResetColor(); continue; } //Console.WriteLine(response.Key); var deltaResponse = JsonConvert.DeserializeObject <DeltaResponse> (await response.Value.Content.ReadAsStringAsync()); teamSitesDeltaLinks[response.Key].DeltaLink = deltaResponse.DeltaLink; if (!firstCall) { foreach (var drive in deltaResponse.DriveItems) { await ProcessChangesAsync(drive, teamSitesDeltaLinks[response.Key].LastSyncDate); } } } //watch.Stop(); //Console.WriteLine($"Checking Teams completed on {watch.ElapsedMilliseconds / 1000} seconds"); libraryDeltaCalls++; } catch (Exception exc) { AddException(exc, "WatchTeamSite"); if (exc.InnerException.Message.Contains("Authentication failed")) { Console.WriteLine($"retry again due {exc.InnerException.Message}"); await Task.Delay(500); await WatchTeamSite(keys); } else { Console.WriteLine(exc.Message); Console.WriteLine(exc.InnerException.Message); Console.WriteLine(exc.StackTrace); } } }
public async Task PostAsyncReturnsBatchResponseContent() { using (HttpResponseMessage responseMessage = new HttpResponseMessage(HttpStatusCode.OK)) using (TestHttpMessageHandler testHttpMessageHandler = new TestHttpMessageHandler()) { /* Arrange */ // 1. create a mock response string requestUrl = "https://localhost/"; string responseJSON = "{\"responses\":" + "[{" + "\"id\": \"1\"," + "\"status\":200," + "\"headers\":{\"Cache-Control\":\"no-cache\",\"OData-Version\":\"4.0\",\"Content-Type\":\"application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8\"}," + "\"body\":{\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users/$entity\",\"displayName\":\"MOD Administrator\",\"jobTitle\":null,\"id\":\"9f4fe8ea-7e6e-486e-b8f4-VkHdanfIomf\"}" + "}," + "{" + "\"id\": \"2\"," + "\"status\":409," + "\"headers\" : {\"Cache-Control\":\"no-cache\"}," + "\"body\":{\"error\": {\"code\": \"20117\",\"message\": \"An item with this name already exists in this location.\",\"innerError\":{\"request-id\": \"nothing1b13-45cd-new-92be873c5781\",\"date\": \"2019-03-22T23:17:50\"}}}" + "}]}"; HttpContent content = new StringContent(responseJSON); responseMessage.Content = content; // 2. Map the response testHttpMessageHandler.AddResponseMapping(requestUrl, responseMessage); // 3. Create a batch request object to be tested MockCustomHttpProvider customHttpProvider = new MockCustomHttpProvider(testHttpMessageHandler); BaseClient client = new BaseClient(requestUrl, authenticationProvider.Object, customHttpProvider); BatchRequest batchRequest = new BatchRequest(requestUrl, client); // 4. Create batch request content to be sent out // 4.1 Create HttpRequestMessages for the content HttpRequestMessage httpRequestMessage1 = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/me/"); HttpRequestMessage httpRequestMessage2 = new HttpRequestMessage(HttpMethod.Post, "https://graph.microsoft.com/v1.0/me/onenote/notebooks"); // 4.2 Create batch request steps with request ids. BatchRequestStep requestStep1 = new BatchRequestStep("1", httpRequestMessage1); BatchRequestStep requestStep2 = new BatchRequestStep("2", httpRequestMessage2, new List <string> { "1" }); // 4.3 Add batch request steps to BatchRequestContent. BatchRequestContent batchRequestContent = new BatchRequestContent(requestStep1, requestStep2); /* Act */ BatchResponseContent returnedResponse = await batchRequest.PostAsync(batchRequestContent); HttpResponseMessage firstResponse = await returnedResponse.GetResponseByIdAsync("1"); HttpResponseMessage secondResponse = await returnedResponse.GetResponseByIdAsync("2"); /* Assert */ // validate the first response Assert.NotNull(firstResponse); Assert.Equal(HttpStatusCode.OK, firstResponse.StatusCode); Assert.True(firstResponse.Headers.CacheControl.NoCache); Assert.NotNull(firstResponse.Content); // validate the second response Assert.NotNull(secondResponse); Assert.Equal(HttpStatusCode.Conflict, secondResponse.StatusCode); Assert.True(secondResponse.Headers.CacheControl.NoCache); Assert.NotNull(secondResponse.Content); } }
public async System.Threading.Tasks.Task BatchRequestContent_GetBatchRequestContentFromStepAsyncDoesNotModifyDateTimes() { var payloadString = "{\r\n" + " \"subject\": \"Let's go for lunch\",\r\n" + " \"body\": {\r\n \"contentType\": \"HTML\",\r\n" + " \"content\": \"Does mid month work for you?\"\r\n" + " },\r\n" + " \"start\": {\r\n" + " \"dateTime\": \"2019-03-15T12:00:00.0000\",\r\n" + " \"timeZone\": \"Pacific Standard Time\"\r\n" + " },\r\n" + " \"end\": {\r\n" + " \"dateTime\": \"2019-03-15T14:00:00.0000\",\r\n" + " \"timeZone\": \"Pacific Standard Time\"\r\n" + " },\r\n \"location\":{\r\n" + " \"displayName\":\"Harry's Bar\"\r\n" + " },\r\n" + " \"attendees\": [\r\n" + " {\r\n" + " \"emailAddress\": {\r\n" + " \"address\":\"[email protected]\",\r\n" + " \"name\": \"Adele Vance\"\r\n" + " },\r\n" + " \"type\": \"required\"\r\n" + " }\r\n" + " ]\r\n" + "}"; BatchRequestStep batchRequestStep1 = new BatchRequestStep("1", new HttpRequestMessage(HttpMethod.Get, REQUEST_URL)); HttpRequestMessage createEventMessage = new HttpRequestMessage(HttpMethod.Post, REQUEST_URL) { Content = new StringContent(payloadString) }; BatchRequestStep batchRequestStep2 = new BatchRequestStep("2", createEventMessage, new List <string> { "1" }); BatchRequestContent batchRequestContent = new BatchRequestContent(); batchRequestContent.AddBatchRequestStep(batchRequestStep1); batchRequestContent.AddBatchRequestStep(batchRequestStep2); JObject requestContent = await batchRequestContent.GetBatchRequestContentAsync(); string content = requestContent.ToString(); string expectedJson = "{\r\n" + " \"requests\": [\r\n" + " {\r\n" + " \"id\": \"1\",\r\n" + " \"url\": \"/me\",\r\n" + " \"method\": \"GET\"\r\n" + " },\r\n" + " {\r\n" + " \"id\": \"2\",\r\n" + " \"url\": \"/me\",\r\n" + " \"method\": \"POST\",\r\n" + " \"dependsOn\": [\r\n" + " \"1\"\r\n" + " ],\r\n" + " \"headers\": {\r\n" + " \"Content-Type\": \"text/plain; charset=utf-8\"\r\n" + " },\r\n" + " \"body\": {\r\n" + " \"subject\": \"Let's go for lunch\",\r\n" + " \"body\": {\r\n" + " \"contentType\": \"HTML\",\r\n" + " \"content\": \"Does mid month work for you?\"\r\n" + " },\r\n" + " \"start\": {\r\n" + " \"dateTime\": \"2019-03-15T12:00:00.0000\",\r\n" + " \"timeZone\": \"Pacific Standard Time\"\r\n" + " },\r\n" + " \"end\": {\r\n" + " \"dateTime\": \"2019-03-15T14:00:00.0000\",\r\n" + " \"timeZone\": \"Pacific Standard Time\"\r\n" + " },\r\n" + " \"location\": {\r\n" + " \"displayName\": \"Harry's Bar\"\r\n" + " },\r\n" + " \"attendees\": [\r\n" + " {\r\n" + " \"emailAddress\": {\r\n" + " \"address\": \"[email protected]\",\r\n" + " \"name\": \"Adele Vance\"\r\n" + " },\r\n" + " \"type\": \"required\"\r\n" + " }\r\n" + " ]\r\n" + " }\r\n" + " }\r\n" + " ]\r\n" + "}"; Assert.NotNull(requestContent); Assert.True(batchRequestContent.BatchRequestSteps.Count.Equals(2)); Assert.Equal(expectedJson, content); }