Esempio n. 1
0
        public async Task GetById_WithRandomId()
        {
            var someId     = Guid.NewGuid();
            var repository = new SiteRepository(SessionFactory, new ContentServiceFactory(_contentFactory));
            var retrieved  = await repository.GetById(someId).ConfigureAwait(false);

            Assert.Null(retrieved);
        }
Esempio n. 2
0
        public async Task GetById_ExistingSite()
        {
            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);

            var siteId = site.Id;

            Assert.AreNotEqual(Guid.Empty, siteId);
            var retrieved = await repository.GetById(siteId).ConfigureAwait(false);

            Assert.AreEqual(internalId, retrieved.InternalId);
        }