Skip to content

Commit

Permalink
Fix for breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
andrueastman committed Jan 11, 2023
1 parent 1f92863 commit 4a7852d
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void ItemById_BuildRequest()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/drives/driveId/items/id");
var itemRequestInformation = graphServiceClient.Drives["driveId"].Items["id"].CreateGetRequestInformation();
var itemRequestInformation = graphServiceClient.Drives["driveId"].Items["id"].ToGetRequestInformation();
itemRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(itemRequestInformation);
Expand All @@ -29,7 +29,7 @@ public void ItemByPath_BuildRequest()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/drives/driveId/root:/item/with/path:");
var itemRequestInformation = graphServiceClient.Drives["driveId"].Root.ItemWithPath("item/with/path").CreateGetRequestInformation();
var itemRequestInformation = graphServiceClient.Drives["driveId"].Root.ItemWithPath("item/with/path").ToGetRequestInformation();
itemRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(itemRequestInformation);
Expand All @@ -41,7 +41,7 @@ public void ItemByPath_BuildRequest2()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/drives/driveId/items/itemId:/item/with/path:");
var itemRequestInformation = graphServiceClient.Drives["driveId"].Items["itemId"].ItemWithPath("item/with/path").CreateGetRequestInformation();
var itemRequestInformation = graphServiceClient.Drives["driveId"].Items["itemId"].ItemWithPath("item/with/path").ToGetRequestInformation();
itemRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(itemRequestInformation);
Expand All @@ -53,7 +53,7 @@ public void ItemByPath_BuildRequestWithLeadingSlash()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/drives/driveId/root:/item/with/path:");
var itemRequestInformation = graphServiceClient.Drives["driveId"].Root.ItemWithPath("/item/with/path").CreateGetRequestInformation();
var itemRequestInformation = graphServiceClient.Drives["driveId"].Root.ItemWithPath("/item/with/path").ToGetRequestInformation();
itemRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(itemRequestInformation);
Expand All @@ -74,7 +74,7 @@ public void ItemByPath_BuildRequestWithSpecialPoundCharacter(string pathInput, s
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/drives/driveId/root:/" + expectedEncodedPath + ":");
var itemRequestInformation = graphServiceClient.Drives["driveId"].Root.ItemWithPath(pathInput).CreateGetRequestInformation();
var itemRequestInformation = graphServiceClient.Drives["driveId"].Root.ItemWithPath(pathInput).ToGetRequestInformation();
itemRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(itemRequestInformation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void DeletedItems()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/me/mailFolders/DeletedItems");
var mailFolderRequestInformation = graphServiceClient.Me.MailFolders["DeletedItems"].CreateGetRequestInformation();
var mailFolderRequestInformation = graphServiceClient.Me.MailFolders["DeletedItems"].ToGetRequestInformation();
mailFolderRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(mailFolderRequestInformation);
Expand All @@ -28,7 +28,7 @@ public void Drafts()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/me/mailFolders/Drafts");
var mailFolderRequestInformation = graphServiceClient.Me.MailFolders["Drafts"].CreateGetRequestInformation();
var mailFolderRequestInformation = graphServiceClient.Me.MailFolders["Drafts"].ToGetRequestInformation();
mailFolderRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(mailFolderRequestInformation);
Expand All @@ -40,7 +40,7 @@ public void Inbox()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/me/mailFolders/Inbox");
var mailFolderRequestInformation = graphServiceClient.Me.MailFolders["Inbox"].CreateGetRequestInformation();
var mailFolderRequestInformation = graphServiceClient.Me.MailFolders["Inbox"].ToGetRequestInformation();
mailFolderRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(mailFolderRequestInformation);
Expand All @@ -52,7 +52,7 @@ public void SentItems()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/me/mailFolders/SentItems");
var mailFolderRequestInformation = graphServiceClient.Me.MailFolders["SentItems"].CreateGetRequestInformation();
var mailFolderRequestInformation = graphServiceClient.Me.MailFolders["SentItems"].ToGetRequestInformation();
mailFolderRequestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(mailFolderRequestInformation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public async Task OneNoteAddPageHtmlWorkaround()
string htmlBody = $"<!DOCTYPE html><html><head><title>{title}</title></head>" +
"<body>Generated from the test</body></html> ";

var requestInformation = graphClient.Me.Onenote.Sections[firstSectionID].Pages.CreatePostRequestInformation(null);
var requestInformation = graphClient.Me.Onenote.Sections[firstSectionID].Pages.ToPostRequestInformation(null);
requestInformation.SetStreamContent(new MemoryStream(Encoding.UTF8.GetBytes(htmlBody)));
requestInformation.Headers.Add("Content-Type","text/html");

Expand Down Expand Up @@ -396,7 +396,7 @@ public async Task OneNoteAddPageHtmlWithStreamWorkaround()
{
// Get the request URL for adding a page. You don't have to use the request builder to
// get the URL. We use it here for convenience.
var requestInformation = graphClient.Me.Onenote.Sections[firstSectionID].Pages.CreateGetRequestInformation();
var requestInformation = graphClient.Me.Onenote.Sections[firstSectionID].Pages.ToGetRequestInformation();

// Create the request body.
string title = "OneNoteAddPageHtmlWithStream test created this";
Expand Down Expand Up @@ -448,7 +448,7 @@ public async Task OneNoteAddPageMultipartWorkaround()
try
{
// Get the request URL for adding a page.
var requestInformation = graphClient.Me.Onenote.Sections[firstSectionID].Pages.CreateGetRequestInformation();
var requestInformation = graphClient.Me.Onenote.Sections[firstSectionID].Pages.ToGetRequestInformation();
string title = "OneNoteAddPageMultipart test created this";
string htmlBody = $@"<!DOCTYPE html><html><head><title>{title}</title></head>
<body>Generated from the test
Expand Down Expand Up @@ -528,7 +528,7 @@ public async Task OneNoteUpdatePage()
string pageId = pageCollection.Value[0].Id;

// URL to update a page. https://graph.microsoft.com/v1.0/me/onenote/sections/{id}/pages/{id}/content
var requestInformation = graphClient.Me.Onenote.Pages[pageId].Content.CreateGetRequestInformation();
var requestInformation = graphClient.Me.Onenote.Pages[pageId].Content.ToGetRequestInformation();

// Create the patch command to update thebody of the OneNote page.
OnenotePatchContentCommand updateBodyCommand = new OnenotePatchContentCommand() {
Expand Down Expand Up @@ -585,7 +585,7 @@ public async Task OneNoteCreatePageWithHtmlStream()
{
// Create a OneNote page.
var requestInformation =
graphClient.Me.Onenote.Sections[firstSectionID].Pages.CreateGetRequestInformation();
graphClient.Me.Onenote.Sections[firstSectionID].Pages.ToGetRequestInformation();
requestInformation.HttpMethod = Method.POST;
requestInformation.Headers.Add("Content-Type","text/html");
testPage = await graphClient.RequestAdapter.SendAsync(requestInformation,OnenotePage.CreateFromDiscriminatorValue);
Expand All @@ -610,7 +610,7 @@ public async Task OneNoteAddPageWithHtml()
"<body>Generated from the test with the partial</body></html> ";

var requestInformation =
graphClient.Me.Onenote.Sections[firstSectionID].Pages.CreateGetRequestInformation();
graphClient.Me.Onenote.Sections[firstSectionID].Pages.ToGetRequestInformation();
requestInformation.HttpMethod = Method.POST;
requestInformation.SetStreamContent(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlBody)));
requestInformation.Headers.Add("Content-Type","text/html");
Expand Down Expand Up @@ -666,7 +666,7 @@ public async Task OneNoteAddPageWithMultipart()

// Get the multiPart stream and then send the request to add a page using the stream.
var requestInformation =
graphClient.Me.Onenote.Sections[firstSectionID].Pages.CreateGetRequestInformation();
graphClient.Me.Onenote.Sections[firstSectionID].Pages.ToGetRequestInformation();
requestInformation.HttpMethod = Method.POST;
requestInformation.SetStreamContent(await multiPartContent.ReadAsStreamAsync());
requestInformation.Headers.Add("Content-Type",contentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public async Task ReportingGetUserCounts()
try
{
// Create the request message.
var getOffice365ActiveUserCountsRequest = graphClient.Reports.GetOffice365ActiveUserCountsWithPeriod("D7").CreateGetRequestInformation();
var getOffice365ActiveUserCountsRequest = graphClient.Reports.GetOffice365ActiveUserCountsWithPeriod("D7").ToGetRequestInformation();

// Send the request and get the response. It will automatically follow the redirect to get the Report file.
var responseStream = await graphClient.RequestAdapter.SendPrimitiveAsync<Stream>(getOffice365ActiveUserCountsRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public async Task UserGetMemberGroups_SecurityEnabledOnly_ValueSet()
var directoryObjectGetMemberGroupsCollectionPage = await getMemberGroupsRequest.PostAsync(requestBody);

Assert.NotNull(directoryObjectGetMemberGroupsCollectionPage);
Assert.Equal("POST", getMemberGroupsRequest.CreatePostRequestInformation(requestBody).HttpMethod.ToString());
Assert.Equal("POST", getMemberGroupsRequest.ToPostRequestInformation(requestBody).HttpMethod.ToString());
Assert.True(requestBody.SecurityEnabledOnly.Value);
}
catch (Microsoft.Graph.ServiceException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void MultipleRequiredParameters()
RemoveLicenses = new ()
};

var requestInformation = graphServiceClient.Me.AssignLicense.CreatePostRequestInformation(requestBody);
var requestInformation = graphServiceClient.Me.AssignLicense.ToPostRequestInformation(requestBody);
requestInformation.PathParameters.Add("baseurl", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

Assert.NotNull(requestInformation);
Expand All @@ -67,7 +67,7 @@ public void OptionalParameterWithNonNullableType_NullValue()
).Returns(new JsonSerializationWriter());

var requestBody = new GetMemberGroupsPostRequestBody { };
var requestInformation = graphServiceClient.Me.GetMemberGroups.CreatePostRequestInformation(requestBody);
var requestInformation = graphServiceClient.Me.GetMemberGroups.ToPostRequestInformation(requestBody);
requestInformation.PathParameters.Add("baseurl", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

Assert.NotNull(requestInformation);
Expand All @@ -90,7 +90,7 @@ public void OptionalParameterWithNonNullableType_ValueSet()
).Returns(new JsonSerializationWriter());

var requestBody = new GetMemberGroupsPostRequestBody { SecurityEnabledOnly = true};
var requestInformation = graphServiceClient.Me.GetMemberGroups.CreatePostRequestInformation(requestBody);
var requestInformation = graphServiceClient.Me.GetMemberGroups.ToPostRequestInformation(requestBody);
requestInformation.PathParameters.Add("baseurl", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

Assert.NotNull(requestInformation);
Expand All @@ -109,7 +109,7 @@ public void NoParameters()
var messageId = "messageId";
var expectedRequestUrl = string.Format("{0}/me/mailFolders/Drafts/messages/{1}/microsoft.graph.send", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"), messageId);

var requestInformation = graphServiceClient.Me.MailFolders["Drafts"].Messages[messageId].Send.CreatePostRequestInformation();
var requestInformation = graphServiceClient.Me.MailFolders["Drafts"].Messages[messageId].Send.ToPostRequestInformation();
requestInformation.PathParameters.Add("baseurl", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

Assert.NotNull(requestInformation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void BuildRequest()
var mockRequestAdapter = new Mock<IRequestAdapter>();
var graphServiceClient = new GraphServiceClient(mockRequestAdapter.Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/groups/groupId/members/$ref");
var requestInformation = graphServiceClient.Groups["groupId"].Members.Ref.CreateGetRequestInformation();
var requestInformation = graphServiceClient.Groups["groupId"].Members.Ref.ToGetRequestInformation();
requestInformation.PathParameters.Add("baseurl", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

Assert.NotNull(requestInformation);
Expand Down Expand Up @@ -94,7 +94,7 @@ public void Top()
var graphServiceClient = new GraphServiceClient(mockRequestAdapter.Object);
var expectedRequestUrl = string.Format("{0}/groups/groupId/members?%24top=1", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

var requestInformation = graphServiceClient.Groups["groupId"].Members.CreateGetRequestInformation(requestConfiguration => requestConfiguration.QueryParameters.Top = 1);
var requestInformation = graphServiceClient.Groups["groupId"].Members.ToGetRequestInformation(requestConfiguration => requestConfiguration.QueryParameters.Top = 1);
requestInformation.PathParameters.Add("baseurl", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

Assert.NotNull(requestInformation);
Expand All @@ -112,7 +112,7 @@ public void OrderBy()
var expectedRequestUrl = string.Format("{0}/groups/groupId/members?%24orderby=value", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

var requestInformation = graphServiceClient.Groups["groupId"].Members
.CreateGetRequestInformation(requestConfiguration =>
.ToGetRequestInformation(requestConfiguration =>
requestConfiguration.QueryParameters.Orderby = new[] { "value" });
requestInformation.PathParameters.Add("baseurl", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void BuildRequest()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "beta") + "/groups/groupId/members");
var requestInformation = graphServiceClient.Groups["groupId"].Members.CreateGetRequestInformation();
var requestInformation = graphServiceClient.Groups["groupId"].Members.ToGetRequestInformation();
requestInformation.PathParameters.Add("baseurl", graphServiceClient.RequestAdapter.BaseUrl);

Assert.NotNull(requestInformation);
Expand Down Expand Up @@ -84,7 +84,7 @@ public void Top()
var graphServiceClient = new GraphServiceClient(mockRequestAdapter.Object);
var expectedRequestUrl = string.Format("{0}/groups/groupId/members?%24top=1", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

var requestInformation = graphServiceClient.Groups["groupId"].Members.CreateGetRequestInformation( requestConfiguration => requestConfiguration.QueryParameters.Top = 1);
var requestInformation = graphServiceClient.Groups["groupId"].Members.ToGetRequestInformation( requestConfiguration => requestConfiguration.QueryParameters.Top = 1);
requestInformation.PathParameters.Add("baseurl", string.Format(Constants.Url.GraphBaseUrlFormatString, "beta"));

Assert.NotNull(requestInformation);
Expand Down
Loading

0 comments on commit 4a7852d

Please sign in to comment.