예제 #1
0
        public async Task Delete_WithRandomId()
        {
            var repository = new SiteRepository(SessionFactory, new ContentServiceFactory(_contentFactory));
            await repository.Delete(Guid.NewGuid()).ConfigureAwait(false);

            // Nothing to assert. Should ignore the request without throwing exception.
        }
예제 #2
0
        private async Task DeleteAllSites()
        {
            var repository = new SiteRepository(SessionFactory, new ContentServiceFactory(_contentFactory));
            var sites      = await repository.GetAll().ConfigureAwait(false);

            var listOfTasks = new List <Task>();

            foreach (var site in sites)
            {
                listOfTasks.Add(repository.Delete(site.Id));
            }
            await Task.WhenAll(listOfTasks).ConfigureAwait(false);
        }
예제 #3
0
        public async Task Delete()
        {
            var internalId = Guid.NewGuid().ToString("N");
            var site       = new Site
            {
                Description = $"Site description {internalId}",
                InternalId  = internalId,
                Title       = $"Title {internalId}"
            };
            var repository = new SiteRepository(SessionFactory, new ContentServiceFactory(_contentFactory));
            await repository.Save(site).ConfigureAwait(false);

            await repository.Delete(site.Id).ConfigureAwait(false);

            var sites = await repository.GetAll().ConfigureAwait(false);

            Assert.AreEqual(0, sites.Count(s => s.Id == site.Id));
        }