public void WhenEntityDeleted_ThenPersists()
        {
            DatabaseTestUtility.DropCreateFirebrickDatabase();

            // Arrange
            var repository = new DomainRepository(new DatabaseFactory());
            Domain entity = DefaultModelHelper.DummyPopulatedDomain();

            // Act
            repository.Add(entity);
            repository.Commit();
            IEnumerable<Domain> returnedEntities = repository.GetAll();

            // Assert
            Assert.Equal(1, returnedEntities.Count());

            // Act
            repository.Delete(entity);
            repository.Commit();

            // Arrange
            // Use a new context and repository to verify the vehicle was deleted
            var repositoryTwo = new DomainRepository(new DatabaseFactory());
            IEnumerable<Domain> verifyEntities = repositoryTwo.GetAll();

            // Assert
            Assert.NotNull(verifyEntities);
            Assert.Equal(0, verifyEntities.Count());
        }
        public void Get_All_Without_Wildcards()
        {
            int contentId = CreateTestData("en-AU", out ContentType ct);

            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                DomainRepository repo = CreateRepository(provider);

                ILanguage lang    = LanguageRepository.GetByIsoCode("en-AU");
                IContent  content = DocumentRepository.Get(contentId);

                for (int i = 0; i < 10; i++)
                {
                    var domain = (IDomain) new UmbracoDomain((i % 2 == 0) ? "test " + i + ".com" : ("*" + i))
                    {
                        RootContentId = content.Id,
                        LanguageId    = lang.Id
                    };
                    repo.Save(domain);
                }

                IEnumerable <IDomain> all = repo.GetAll(false);

                Assert.AreEqual(5, all.Count());
            }
        }
        public void WhenGetAllFromEmptyDatabase_ThenReturnsEmptyCollection()
        {
            DatabaseTestUtility.DropCreateFirebrickDatabase();

            var repository = new DomainRepository(new DatabaseFactory());
            IEnumerable<Domain> actual = repository.GetAll();

            Assert.NotNull(actual);
            var actualList = new List<Domain>(actual);
            Assert.Equal(0, actualList.Count);
        }