public void ClearContents_AllBlocksDeleted()
        {
            var repository = Fixture.GetInstance <IContentRepository>();

            Fixture.CreateBlock <HeroBlock>();
            Assert.Single(repository.GetChildren <HeroBlock>(ContentReference.GlobalBlockFolder));

            var command = new ClearContents();

            command.Clear();

            Assert.Empty(repository.GetChildren <HeroBlock>(ContentReference.GlobalBlockFolder));
        }
        public void ClearContents_AllMediasDeleted()
        {
            var repository = Fixture.GetInstance <IContentRepository>();

            Fixture.Upload <ImageFile>(Resources.Get("/images").PickRandom());

            Assert.Single(repository.GetChildren <ImageFile>(ContentReference.GlobalBlockFolder));

            var command = new ClearContents();

            command.Clear();

            Assert.Empty(repository.GetChildren <ImageFile>(ContentReference.GlobalBlockFolder));
        }
        public void ClearContents_AllPagesDeleted()
        {
            var repository = Fixture.GetInstance <IContentRepository>();

            Fixture.Create <StartPage>().Create <ArticlePage>();

            Assert.Single(repository.GetChildren <StartPage>(ContentReference.RootPage));

            var command = new ClearContents();

            command.Clear();


            Assert.Empty(repository.GetChildren <StartPage>(ContentReference.RootPage));
        }
        public void ClearContents_AllMediasFilesDeleted()
        {
            var repository = Fixture.GetInstance <IContentRepository>();
            var registry   = Fixture.GetInstance <IBlobProviderRegistry>();
            var provider   = (FileBlobProvider)registry.GetProvider(new Uri("//default"));

            Fixture.Upload <ImageFile>(Resources.Get("/images").PickRandom());

            Assert.Single(Directory.EnumerateDirectories(provider.Path));

            var command = new ClearContents();

            command.Clear();

            Assert.Empty(Directory.EnumerateDirectories(provider.Path));
        }
        public IEnumerable <IClearCommand> Reset()
        {
            var clearContents = new ClearContents();

            if (!IamAwareThatTheFilesAndFoldersAtAppDataPathWillBeDeleted)
            {
                throw new InvalidOperationException($"You need to be aware that the files and folders at the path {clearContents.GetPath()} will be deleted before each test.");
            }

            return(new List <IClearCommand>()
            {
                clearContents,
                new ClearCategories(),
                new ClearSites()
            });
        }