public async Task Save_SetsId()
        {
            Site siteModelRetrieved = await MakeSite().ConfigureAwait(false);

            var aliasModel = new Alias
            {
                SiteId      = siteModelRetrieved.Id,
                AliasUrl    = "blog.example.com",
                RedirectUrl = "www.example.com/blog",
                Type        = RedirectType.Temporary
            };
            var aliasRepository = new AliasRepository(SessionFactory);
            await aliasRepository.Save(aliasModel).ConfigureAwait(false);

            Assert.False(aliasModel.Id == Guid.Empty);
        }
        public async Task SaveGetAll_HappyPath()
        {
            Site siteModelRetrieved = await MakeSite().ConfigureAwait(false);

            var aliasModel = new Alias
            {
                SiteId      = siteModelRetrieved.Id,
                AliasUrl    = "blog.example.com",
                RedirectUrl = "www.example.com/blog",
                Type        = RedirectType.Temporary
            };
            var aliasRepository = new AliasRepository(SessionFactory);
            await aliasRepository.Save(aliasModel).ConfigureAwait(false);

            var aliases = await aliasRepository.GetAll(siteModelRetrieved.Id).ConfigureAwait(false);

            Assert.AreEqual(1, aliases.Count());
        }
        public async Task GetById()
        {
            var  aliasId            = Guid.NewGuid().ToString("N");
            Site siteModelRetrieved = await MakeSite().ConfigureAwait(false);

            string redirectUrl = $"www.example.com/blog?id={aliasId}";
            var    aliasModel  = new Alias
            {
                SiteId      = siteModelRetrieved.Id,
                AliasUrl    = "blog.example.com",
                RedirectUrl = redirectUrl,
                Type        = RedirectType.Temporary
            };
            var aliasRepository = new AliasRepository(SessionFactory);
            await aliasRepository.Save(aliasModel).ConfigureAwait(false);

            var retrievedAlias = await aliasRepository.GetById(aliasModel.Id).ConfigureAwait(false);

            Assert.AreEqual(aliasModel.Id, retrievedAlias.Id);
            Assert.AreEqual(redirectUrl, retrievedAlias.RedirectUrl);
        }
        public async Task Delete()
        {
            var  aliasId            = Guid.NewGuid().ToString("N");
            Site siteModelRetrieved = await MakeSite().ConfigureAwait(false);

            var aliasModel = new Alias
            {
                SiteId      = siteModelRetrieved.Id,
                AliasUrl    = "blog.example.com",
                RedirectUrl = $"www.example.com/blog?id={aliasId}",
                Type        = RedirectType.Temporary
            };
            var aliasRepository = new AliasRepository(SessionFactory);
            await aliasRepository.Save(aliasModel).ConfigureAwait(false);

            var aliases = await aliasRepository.GetAll(siteModelRetrieved.Id).ConfigureAwait(false);

            var toDelete = aliases.First(x => x.RedirectUrl.Contains(aliasId));
            await aliasRepository.Delete(toDelete.Id).ConfigureAwait(false);

            aliases = await aliasRepository.GetAll(siteModelRetrieved.Id).ConfigureAwait(false);

            Assert.False(aliases.Any(x => x.RedirectUrl.Contains(aliasId)));
        }