コード例 #1
0
        public async Task Update()
        {
            ICommunityDao communityDao = new AdoCommunityDao(DefaultConnectionFactory.FromConfiguration(configName));

            Community community = await communityDao.FindByIdAsync(1);

            string originalName = community.Name;

            community.Name = "New name";
            bool update1 = await communityDao.UpdateCommunityAsync(community);

            Assert.IsTrue(update1);

            community = await communityDao.FindByIdAsync(1);

            Assert.AreEqual(community.Name, "New name");

            community.Name = originalName;
            bool update2 = await communityDao.UpdateCommunityAsync(community);

            Assert.IsTrue(update2);

            community = await communityDao.FindByIdAsync(1);

            Assert.AreEqual(community.Name, originalName);
        }
コード例 #2
0
        public async Task TestFindById()
        {
            ICommunityDao communityDao = new AdoCommunityDao(DefaultConnectionFactory.FromConfiguration(configName));

            Community community1 = await communityDao.FindByIdAsync(1);

            Assert.AreEqual(community1.Id, 1);

            Community community5000 = await communityDao.FindByIdAsync(5000);

            Assert.IsNull(community5000);
        }