GetChildDirectory() public method

Gets interface for a given child directory
public GetChildDirectory ( string childName ) : IFileSystemDirectory
childName string Name of the child directory
return IFileSystemDirectory
Exemplo n.º 1
0
        public void KeepsPersistentReferences()
        {
            var cdir = new TestFileSystemDirectory("cache",
                new[]
                {
                    new TestFileSystemDirectory("Bari.Core.Test.Build.Cache.NonPersistentReference_1"),
                    new TestFileSystemDirectory("Bari.Core.Test.Build.Cache.NonPersistentReference_2"),
                    new TestFileSystemDirectory("Bari.Core.Test.Build.Cache.PersistentReference_3"),
                    new TestFileSystemDirectory("Bari.Core.Test.Build.Cache.PersistentReference_4")
                });

            var be = new Mock<IBuilderEnumerator>();
            be.Setup(b => b.GetAllPersistentBuilders()).Returns(new[] {typeof(PersistentReference)});

            var predicates = new SoftCleanPredicates();
            var cleaner = new CacheCleaner(new Lazy<IFileSystemDirectory>(() => cdir), be.Object, () => predicates);

            cdir.IsDeleted.Should().BeFalse();
            ((TestFileSystemDirectory) cdir.GetChildDirectory("Bari.Core.Test.Build.Cache.NonPersistentReference_1"))
                .IsDeleted.Should().BeFalse();
            ((TestFileSystemDirectory)cdir.GetChildDirectory("Bari.Core.Test.Build.Cache.NonPersistentReference_2"))
                .IsDeleted.Should().BeFalse();
            ((TestFileSystemDirectory)cdir.GetChildDirectory("Bari.Core.Test.Build.Cache.PersistentReference_3"))
                .IsDeleted.Should().BeFalse();
            ((TestFileSystemDirectory)cdir.GetChildDirectory("Bari.Core.Test.Build.Cache.PersistentReference_4"))
                .IsDeleted.Should().BeFalse();

            var parameters = new Mock<ICleanParameters>();
            parameters.SetupGet(p => p.KeepReferences).Returns(true);

            cleaner.Clean(parameters.Object);

            cdir.IsDeleted.Should().BeFalse();
            ((TestFileSystemDirectory)cdir.GetChildDirectory("Bari.Core.Test.Build.Cache.NonPersistentReference_1"))
                .IsDeleted.Should().BeTrue();
            ((TestFileSystemDirectory)cdir.GetChildDirectory("Bari.Core.Test.Build.Cache.NonPersistentReference_2"))
                .IsDeleted.Should().BeTrue();
            ((TestFileSystemDirectory)cdir.GetChildDirectory("Bari.Core.Test.Build.Cache.PersistentReference_3"))
                .IsDeleted.Should().BeFalse();
            ((TestFileSystemDirectory)cdir.GetChildDirectory("Bari.Core.Test.Build.Cache.PersistentReference_4"))
                .IsDeleted.Should().BeFalse();
        }
Exemplo n.º 2
0
        public void ModuleRootIsChildOfSuiteRoot()
        {
            var fs = new TestFileSystemDirectory(
                "root", new TestFileSystemDirectory(
                            "src", new TestFileSystemDirectory("test")));
            var module = new Module("test", new Suite(fs));

            module.RootDirectory.Should().Be(
                fs.GetChildDirectory("src").GetChildDirectory("test"));
        }