コード例 #1
0
        public async Task Delete_WithRandomId()
        {
            var repository       = new PostTypeRepository(SessionFactory);
            var randomPostTypeId = $"PostType-{RandomNumber.Next()}";
            await repository.Delete(randomPostTypeId).ConfigureAwait(false);

            // should not throw an error
        }
コード例 #2
0
        public async Task GetById_WithRandomId()
        {
            var repository       = new PostTypeRepository(SessionFactory);
            var randomPostTypeId = $"PostType-{RandomNumber.Next()}";
            var retrieved        = await repository.GetById(randomPostTypeId).ConfigureAwait(false);

            Assert.Null(retrieved);
        }
コード例 #3
0
        public async Task SaveGetById()
        {
            var repository = new PostTypeRepository(SessionFactory);
            var postType   = MakePostType();
            var postTypeId = postType.Id;
            await repository.Save(postType).ConfigureAwait(false);

            var retrieved = await repository.GetById(postTypeId).ConfigureAwait(false);

            Assert.AreEqual(postTypeId, retrieved.Id);
            Assert.AreEqual(1, retrieved.Regions.Count);
        }
コード例 #4
0
        public async Task Delete()
        {
            var repository = new PostTypeRepository(SessionFactory);
            var postType   = MakePostType();
            var postTypeId = postType.Id;
            await repository.Save(postType).ConfigureAwait(false);

            await repository.Delete(postTypeId).ConfigureAwait(false);

            var retrieved = await repository.GetById(postTypeId).ConfigureAwait(false);

            Assert.Null(retrieved);
        }