public async Task GetAssociatedGroupsWithUsers_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("GetWebAssociatedGroupsWithUsersResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var actual = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Request() .GetAssociatedGroupsAsync(true); // ASSERT Assert.NotNull(actual.AssociatedMemberGroup); Assert.IsType <Group>(actual.AssociatedMemberGroup); Assert.Single(actual.AssociatedMemberGroup.Users); Assert.NotNull(actual.AssociatedOwnerGroup); Assert.IsType <Group>(actual.AssociatedOwnerGroup); Assert.Single(actual.AssociatedOwnerGroup.Users); Assert.NotNull(actual.AssociatedVisitorGroup); Assert.IsType <Group>(actual.AssociatedVisitorGroup); Assert.Empty(actual.AssociatedVisitorGroup.Users); } }
public async Task GetAll_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("GetSiteDesignRunsResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteDesignRuns .Request() .GetAsync(); var actual = response.CurrentPage; // ASSERT Assert.Equal(2, actual.Count); Assert.Equal("8fa899bb-aebb-4579-9cbd-ac73b4e8fc72", actual[0].Id); Assert.Equal(new Guid("18afc7e7-4ee6-4af0-8061-262dfc3cf174"), actual[0].SiteDesignId); Assert.Equal("Graph.Community Development", actual[0].SiteDesignTitle); Assert.Equal(1, actual[0].SiteDesignVersion); Assert.Equal(new Guid("45a83b5d-8ed1-4233-bf1e-960bbe2efd27"), actual[0].SiteId); Assert.Equal(1597721362000, actual[0].StartTime); Assert.Equal(new Guid("cd5f4ac4-40cc-4a4c-8640-7acf7ec579c4"), actual[0].WebId); } }
public async Task GetAssociatedGroupsWithUsers_GeneratesCorrectRequest() { // ARRANGE var expectedUri = new Uri($"{mockWebUrl}/_api/web?$expand=associatedownergroup,associatedmembergroup,associatedvisitorgroup,associatedownergroup/users,associatedmembergroup/users,associatedvisitorgroup/users&$select=id,title,associatedownergroup,associatedmembergroup,associatedvisitorgroup"); using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Request() .GetAssociatedGroupsAsync(true); var actualContent = gsc.HttpProvider.ContentAsString; // ASSERT gsc.HttpProvider.Verify( provider => provider.SendAsync( It.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Get && req.RequestUri == expectedUri && req.Headers.Authorization != null ), It.IsAny <HttpCompletionOption>(), It.IsAny <CancellationToken>() ), Times.Exactly(1) ); } }
public async Task GetWithId_ReturnsCorrectResponse() { // ARRANGE var mockSiteScriptId = "0d7cf729-42e7-411b-86c6-b0181f912dd4"; var responseContent = ResourceManager.GetHttpResponseContent("GetSiteScriptMetadataResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteScripts[mockSiteScriptId] .Request() .GetAsync(); var actual = response.CurrentPage; // ASSERT Assert.Equal(1, actual.Count); Assert.Equal("0d7cf729-42e7-411b-86c6-b0181f912dd4", actual[0].Id); Assert.Equal("mockSiteScriptTitle", actual[0].Title); Assert.Equal(1, actual[0].Version); Assert.Equal("{\"$schema\": \"schema.json\",\"actions\": [{\"verb\": \"applyTheme\",\"themeName\": \"Red\"}],\"bindata\": { },\"version\": 1}", actual[0].Content); } }
public async Task GetAll_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("GetWebAppTilesResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .AppTiles .Request() .GetAsync(); var actual = response.CurrentPage; // ASSERT Assert.Equal(10, actual.Count); Assert.Equal("264ae551-d91e-4a00-89c3-5d2300006cee", actual[1].AppId.ToString()); Assert.Equal(AppStatus.Installed, actual[1].AppStatus); Assert.Equal("1/16/2020 10:15 PM", actual[1].LastModified); Assert.Equal(new DateTimeOffset(2020, 01, 16, 22, 15, 12, new TimeSpan(0)), actual[1].LastModifiedDate); } }
public async Task GetSiteUsers_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("GetSiteUsersResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .SiteUsers .Request() .GetAsync(); var actual = response; // ASSERT Assert.Equal(8, actual.Count); Assert.Equal(12, actual[5].Id); Assert.False(actual[5].IsSiteAdmin); Assert.Equal("Megan Bowen", actual[5].Title); Assert.Equal(SPPrincipalType.User, actual[5].PrincipalType); Assert.Equal("*****@*****.**", actual[5].UserPrincipalName); } }
public async Task Get_GeneratesCorrectRequest() { // ARRANGE var expectedUri = new Uri("https://graph.microsoft.com/v1.0/me/mailboxSettings"); using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT await gsc.GraphServiceClient .Me .MailboxSettings() .Request() .GetAsync(); // ASSERT gsc.HttpProvider.Verify( provider => provider.SendAsync( It.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Get && req.RequestUri == expectedUri && req.Headers.Authorization != null ), It.IsAny <HttpCompletionOption>(), It.IsAny <CancellationToken>() ), Times.Exactly(1) ); } }
public async Task EnsureUser_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("EnsureUserResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Request() .EnsureUserAsync("alexw"); var actual = response; // ASSERT Assert.Equal(14, actual.Id); Assert.False(actual.IsSiteAdmin); Assert.Equal("Alex Wilber", actual.Title); Assert.Equal(SPPrincipalType.User, actual.PrincipalType); Assert.Equal("*****@*****.**", actual.UserPrincipalName); } }
public async Task GetSiteGroups_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("GetSiteGroupsResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .SiteGroups .Request() .GetAsync(); var actual = response; // ASSERT Assert.Equal(5, actual.Count); Assert.Equal(4, actual[2].Id); Assert.False(actual[2].AllowMembersEditMembership); Assert.Equal("Mock Site Visitors", actual[2].Title); Assert.Equal(SPPrincipalType.SharePointGroup, actual[2].PrincipalType); } }
public async Task GetAll_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("GetSiteScriptsResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteScripts .Request() .GetAsync(); var actual = response.CurrentPage; // ASSERT Assert.Equal(2, actual.Count); Assert.Equal("0d7cf729-42e7-411b-86c6-b0181f912dd4", actual[0].Id); Assert.Equal("mockSiteScriptTitle", actual[0].Title); Assert.Equal(1, actual[0].Version); } }
public async Task Get_ReturnsCorrectResponse() { // ARRANGE var responseContent = "{\"odata.metadata\":\"https://mock.sharepoint.com/_api/$metadata#SP.ApiData.Navigations/@Element\",\"odata.type\":\"SP.Navigation\",\"odata.id\":\"https://mock.sharepoint.com/_api/web/navigation\",\"odata.editLink\":\"web/navigation\",\"UseShared\":false}"; var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Navigation .Request() .GetAsync(); var actual = response; // ASSERT Assert.False(actual.UseShared); } }
public async Task GetAll_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("NavigationNodeCollectionResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Navigation .QuickLaunch .Request() .GetAsync(); var actual = response; // ASSERT Assert.Equal(7, actual.Count); Assert.Equal(2003, actual[3].Id); Assert.True(actual[3].IsDocLib); Assert.False(actual[3].IsExternal); Assert.True(actual[3].IsVisible); Assert.Equal(1230, actual[3].ListTemplateType); Assert.Equal("Apps in Testing", actual[3].Title); Assert.Equal(new Uri("/Lists/DraftApps/AllItems.aspx", UriKind.Relative), actual[3].Url); } }
public async Task Create_MissingProperties_Throws(string title, string siteScriptId, string webTemplate) { var siteScriptIds = string.IsNullOrEmpty(siteScriptId) ? null : new System.Collections.Generic.List <Guid>() { new Guid(siteScriptId) }; var newSiteDesign = new SiteDesignMetadata() { Title = title, Description = "mockSiteDesignDescription", SiteScriptIds = siteScriptIds, WebTemplate = webTemplate, PreviewImageUrl = "https://mock.sharepoint.com", PreviewImageAltText = "mockPreviewImageAltText" }; using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { await Assert.ThrowsAsync <ArgumentException>( async() => await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteDesigns .Request() .CreateAsync(newSiteDesign) ); } }
public async Task GetAll_GeneratesCorrectRequest() { // ARRANGE var expectedUri = new Uri($"{mockWebUrl}/_api/web/apptiles"); using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .AppTiles .Request() .GetAsync(); // ASSERT gsc.HttpProvider.Verify( provider => provider.SendAsync( It.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Get && req.RequestUri == expectedUri && req.Headers.Authorization != null ), It.IsAny <HttpCompletionOption>(), It.IsAny <CancellationToken>() ), Times.Exactly(1) ); } }
public async Task GetById_GeneratesCorrectRequest() { // ARRANGE int testUserId = 10; var expectedUri = new Uri($"{mockWebUrl}/_api/web/siteusers/getbyid({testUserId})"); using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .SiteUsers[testUserId] .Request() .GetAsync(); // ASSERT gsc.HttpProvider.Verify( provider => provider.SendAsync( It.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Get && req.RequestUri.ToString().ToLower() == expectedUri.ToString().ToLower() && req.Headers.Authorization != null ), It.IsAny <HttpCompletionOption>(), It.IsAny <CancellationToken>() ), Times.Exactly(1) ); } }
public async Task GetAll_ReturnsCorrectResponse() { // ARRANGE var responseContent = ResourceManager.GetHttpResponseContent("GetSiteUsersResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .SiteUsers .Request() .GetAsync(); var actual = response; // ASSERT Assert.Equal(8, actual.Count); Assert.Null(actual[1].UserId); } }
public async Task Query_ReturnsCorrectResponse() { // ARRANGE var searchText = "sharepoint"; var responseContent = ResourceManager.GetHttpResponseContent("SearchQueryResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Search .Request() .QueryAsync(searchText); var actual = response; // ASSERT Assert.Equal(5, actual.PrimaryQueryResult.RelevantResults.RowCount); Assert.Equal(3945, actual.PrimaryQueryResult.RelevantResults.TotalRows); Assert.Equal("Megan Bowen", actual.PrimaryQueryResult.RelevantResults.Table.Rows[2].Cells[4].Value); } }
public async Task SetsDefaultHandlerOption() { // ARRANGE var handler = new MockSharePointServiceHandler(); var client = GraphServiceTestClient.Create(handler); var req = new BaseSharePointAPIRequest("TEST", "http://localhost", client.GraphServiceClient, null); // ACT await req.SendAsync(null, CancellationToken.None); // ASSERT Assert.True(handler.HasOptions); }
public async Task EnsureUser_NullParameter_Throws() { using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { await Assert.ThrowsAsync <ArgumentNullException>( async() => await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Request() .EnsureUserAsync(null) ); } }
public async Task Create_NullParams_Throws() { using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT & ASSERT await Assert.ThrowsAsync <ArgumentNullException>( async() => await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteScripts .Request() .CreateAsync(null) ); } }
public async Task GetWithId_MissingId_Throws(string siteDesignId) { using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT & ASSERT await Assert.ThrowsAsync <ArgumentNullException>( async() => await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteScripts[siteDesignId] .Request() .CreateAsync(null) ); } }
public async Task SetsHandlerOption() { // ARRANGE var handler = new MockSharePointServiceHandler(); var client = GraphServiceTestClient.Create(handler); var expected = true; var req = new BaseSharePointAPIRequest("TEST", "http://localhost", client.GraphServiceClient, null); // ACT await req.WithTelemetryDisabled().SendAsync(null, CancellationToken.None); // ASSERT Assert.Equal(expected, handler.Options.DisableTelemetry); Assert.Equal("TEST", handler.Options.ResourceUri); }
public void WithODataCastUpdatesUrl() { // ARRANGE var oDataCast = "microsoft.graph.directoryRole"; var expectedUrl = "/me/memberOf/microsoft.graph.directoryRole"; // ACT using (var gsc = GraphServiceTestClient.Create()) { var request = gsc.GraphServiceClient.Me.MemberOf.WithODataCast(oDataCast).Request(); var actualUrl = request.RequestUrl; // ASSERT Assert.True(actualUrl.IndexOf(expectedUrl) > -1, "RequestUrl does not include odata cast value"); } }
public async Task AddNode_NullCreationInfo_Throws() { using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { await Assert.ThrowsAsync <ArgumentNullException>( async() => await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Navigation .QuickLaunch .Request() .AddAsync(null) ); } }
public void GeneratesCorrectRequestHeaders() { using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT var request = gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Search .Request() .GetHttpRequestMessage(); // ASSERT Assert.Equal(SharePointAPIRequestConstants.Headers.SearchAcceptHeaderValue, request.Headers.Accept.ToString()); } }
public async Task Create_GeneratesCorrectRequest() { // ARRANGE var newSiteDesign = new SiteDesignMetadata() { Title = "mockSiteDesign", Description = "mockSiteDesignDescription", SiteScriptIds = new System.Collections.Generic.List <Guid>() { new Guid("a0da01a9-8b93-496e-9bbd-1b53009e543e") }, WebTemplate = "64", PreviewImageUrl = "https://mock.sharepoint.com", PreviewImageAltText = "mockPreviewImageAltText" }; var expectedUri = new Uri($"{mockWebUrl}/_api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility.CreateSiteDesign"); var expectedContent = "{\"info\":{\"Title\":\"mockSiteDesign\",\"Description\":\"mockSiteDesignDescription\",\"SiteScriptIds\":[\"a0da01a9-8b93-496e-9bbd-1b53009e543e\"],\"WebTemplate\":\"64\",\"PreviewImageUrl\":\"https://mock.sharepoint.com\",\"PreviewImageAltText\":\"mockPreviewImageAltText\"}}"; using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteDesigns .Request() .CreateAsync(newSiteDesign); var actualContent = gsc.HttpProvider.ContentAsString; // ASSERT gsc.HttpProvider.Verify( provider => provider.SendAsync( It.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Post && req.RequestUri == expectedUri && req.Headers.Authorization != null ), It.IsAny <HttpCompletionOption>(), It.IsAny <CancellationToken>() ), Times.Exactly(1) ); Assert.Equal(expectedContent, actualContent); } }
public async Task CreateSiteDesign_ReturnsCorrectResponse() { // ARRANGE var newSiteDesign = new SiteDesignMetadata() { Title = "mockSiteDesign", Description = "mockSiteDesignDescription", SiteScriptIds = new System.Collections.Generic.List <Guid>() { new Guid("a0da01a9-8b93-496e-9bbd-1b53009e543e") }, WebTemplate = "64", PreviewImageUrl = "https://mock.sharepoint.com", PreviewImageAltText = "mockPreviewImageAltText" }; var responseContent = ResourceManager.GetHttpResponseContent("CreateSiteDesignResponse.json"); var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseContent), }; using (responseMessage) using (var gsc = GraphServiceTestClient.Create(responseMessage)) { // ACT var response = await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteDesigns .Request() .CreateAsync(newSiteDesign); var actual = response; // ASSERT Assert.Equal("d3e90db2-9a67-4d24-b59f-7c54388a9cfa", actual.Id); Assert.Equal("mockSiteDesign", actual.Title); Assert.Equal("mockSiteDesignDescription", actual.Description); Assert.Equal(Guid.Empty, actual.DesignPackageId); Assert.False(actual.IsDefault); Assert.Equal("mockPreviewImageAltText", actual.PreviewImageAltText); Assert.Equal("https://mock.sharepoint.com", actual.PreviewImageUrl); Assert.Equal("64", actual.WebTemplate); Assert.Single(actual.SiteScriptIds); Assert.Equal(new Guid("a0da01a9-8b93-496e-9bbd-1b53009e543e"), actual.SiteScriptIds[0]); } }
public async Task UpdateNode_NullCreationInfo_Throws() { var mockNodeId = 2003; using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { await Assert.ThrowsAsync <ArgumentNullException>( async() => await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Navigation[mockNodeId] .Request() .UpdateAsync(null) ); } }
public void GeneratesCorrectRequestHeaders() { using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT var request = gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .SiteDesigns .Request() .GetHttpRequestMessage(); // ASSERT Assert.Equal(SharePointAPIRequestConstants.Headers.AcceptHeaderValue, request.Headers.Accept.ToString()); Assert.True(request.Headers.Contains(SharePointAPIRequestConstants.Headers.ODataVersionHeaderName), $"Header does not contain {SharePointAPIRequestConstants.Headers.ODataVersionHeaderName} header"); Assert.Equal(SharePointAPIRequestConstants.Headers.ODataVersionHeaderValue, string.Join(',', request.Headers.GetValues(SharePointAPIRequestConstants.Headers.ODataVersionHeaderName))); } }
public async Task UpdateNode_GeneratesCorrectRequest() { // ARRANGE var mockNodeId = 2003; var expectedUri = new Uri($"{mockWebUrl}/_api/web/navigation/getbyid({mockNodeId})"); var mockUpdatedNodeRequest = new NavigationNode() { Title = "mockTitle", Url = new Uri("https://mocksite.com") }; var expectedContent = "{\"Title\":\"mockTitle\",\"Url\":\"https://mocksite.com\"}"; using (var response = new HttpResponseMessage()) using (var gsc = GraphServiceTestClient.Create(response)) { // ACT await gsc.GraphServiceClient .SharePointAPI(mockWebUrl) .Web .Navigation[mockNodeId] .Request() .UpdateAsync(mockUpdatedNodeRequest); var actualContent = gsc.HttpProvider.ContentAsString; // ASSERT gsc.HttpProvider.Verify( provider => provider.SendAsync( It.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Post && req.RequestUri == expectedUri && req.Headers.Authorization != null && string.Join("", req.Headers.GetValues("X-HTTP-Method")) == "MERGE" ), It.IsAny <HttpCompletionOption>(), It.IsAny <CancellationToken>() ), Times.Exactly(1) ); Assert.Equal(Microsoft.Graph.CoreConstants.MimeTypeNames.Application.Json, gsc.HttpProvider.ContentHeaders.ContentType.MediaType); Assert.Equal(expectedContent, actualContent); } }