Skip to content

GetComments() only return maximum of 30 comments. It used to return all comments. #1361

@larry-lau

Description

@larry-lau

Category

  • Bug

Describe the bug

GetComments() used to return all comments. Now it is only returning 30 comments.

Steps to reproduce

  1. See code block below
  2. Add the following unit test to the PagesTests.cs in PnP.Core.Test project
  3. Run the test without mocking turned off.
  4. Assertion failure since it returns 30 comments instead of 45 that get added in this test.
[TestMethod]
public async Task PageCommentingTestOnlyReturn30Comments()
{
    TestCommon.Instance.Mocking = false;
    using (var context = await TestCommon.Instance.GetContextAsync(TestCommon.TestSite))
    {
        var newPage = await context.Web.NewPageAsync();
        string pageName = TestCommon.GetPnPSdkTestAssetName("PageCommentingTest.aspx");

        // Save the page
        await newPage.SaveAsync(pageName);

        // Publish the page, required before it can be liked
        newPage.Publish();

        // Get Page comments                
        var comments = newPage.GetComments();
        Assert.IsTrue(comments.Length == 0);

        var noCommentsAdded = 45;

        foreach (var i in Enumerable.Range(1, noCommentsAdded))
        {
            // Add a comment
            comments.Add($"Comment #: {i} added by unit test");
        }

        comments = newPage.GetComments();
        // Expecting 45 but only 30 is returned. 
        Assert.IsTrue(comments.Length == noCommentsAdded);

        // Delete the page
        await newPage.DeleteAsync();
    }
}

Expected behavior

GetComments() should return all comments like it used to.

Environment details (development & target environment)

  • SDK version: 1.11.0
  • OS: [e.g. Windows 10 | MacOS 10.15.x]
  • SDK used in: [Console App]
  • Framework: [.NET 7/8 ]
  • Browser(s): [N/A]
  • Tooling: [Visual Studio 2021]
  • Additional details: **

Additional context

Thanks for your contribution! Sharing is caring.

Metadata

Metadata

Assignees

Labels

area: model 📐Related to the core SDK modelsbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions