예제 #1
0
        public async Task TestGetUsers()
        {
            var session = new NotionSession(TestUtils.CreateOfficialNotionSessionInfo());
            var users   = session.GetUsers();

            Assert.IsNotNull(users);
            int i, iBot, iPerson;

            i = iBot = iPerson = 0;
            await foreach (var user in users)
            {
                i++;
                if (user.UserType == UserTypeConst.Bot)
                {
                    iBot++;
                }
                if (user.UserType == UserTypeConst.Person)
                {
                    iPerson++;
                }
            }

            Assert.AreEqual(2, i);
            Assert.AreEqual(1, iBot);
            Assert.AreEqual(1, iPerson);
        }
예제 #2
0
        public async Task TestGetUser()
        {
            var session = new NotionSession(TestUtils.CreateOfficialNotionSessionInfo());
            var user1a  = await session.GetUsers().FirstAsync();

            Assert.IsNotNull(user1a);

            var user1b = await session.GetUser(user1a.Id);

            Assert.IsTrue(user1a.Equals(user1b));
        }