예제 #1
0
        public async Task TestGetHtml()
        {
            var session = new NotionSession(TestUtils.CreateOfficialNotionSessionInfo());
            var page    = await session.Search(filterOptions : FilterOptions.ObjectPage)
                          .FirstAsync(p => p.Title?.Title?.FirstOrDefault().PlainText == "Procrastination");

            Assert.IsNotNull(page);

            var html = await session.GetHtml(page);

            Assert.IsFalse(string.IsNullOrWhiteSpace(html));
        }
예제 #2
0
        public async Task TestSearch()
        {
            var session = new NotionSession(TestUtils.CreateOfficialNotionSessionInfo());

            var         totalItems = 0;
            List <Page> pages      = new ();

            await foreach (var item in session.Search(pageSize: 2))
            {
                totalItems++;
                pages.Add(item);
            }

            Assert.AreEqual(4, totalItems);
        }
예제 #3
0
        public async Task TestGetPage()
        {
            var session = new NotionSession(TestUtils.CreateOfficialNotionSessionInfo());
            //Get any page returned by search
            var page = await session.Search(pageSize : 1, filterOptions : FilterOptions.ObjectPage).FirstAsync();

            Assert.IsNotNull(page);

            Assert.IsNotNull(page.Id);

            //Get the page details
            var pageProperties = await session.GetPage(page.Id);

            Assert.IsNotNull(pageProperties);
            Assert.IsNotNull(pageProperties.Parent);
            Assert.IsNotNull(pageProperties.Properties);
            var title = pageProperties.Title;

            Assert.IsNotNull(title);
            Assert.IsNotNull(title.Title);
            Assert.AreNotEqual(0, title.Title.Count);
            var id = pageProperties.Id;
        }