Пример #1
0
        public void Get_folders_and_files()
        {
            var repoBuilder = new RepoBuilder(@"c:\temp\");
            var git         = repoBuilder.BuildEmptyRepo();

            repoBuilder.AddFile(@"FeatureVolvo\car.txt", "car");
            repoBuilder.AddFile(@"FeatureGarden\tree.txt", "tree");
            repoBuilder.AddFile(@"FeatureGarden\shovel.txt", "shovel");
            repoBuilder.AddFile(@"FeatureGarden\Suburb\grass.txt", "grass");
            repoBuilder.AddFile(@"FeatureGarden\Suburb\mover.txt", "mover");

            var files = FileSystemScanFolder(git);

            Assert.Equal(
                @"tree 2 
tree 3 FeatureGarden
blob FeatureGarden\shovel.txt
blob FeatureGarden\tree.txt
tree 2 FeatureGarden\Suburb
blob FeatureGarden\Suburb\grass.txt
blob FeatureGarden\Suburb\mover.txt
tree 1 FeatureVolvo
blob FeatureVolvo\car.txt"
                , files);
        }
Пример #2
0
        public void Visit()
        {
            var repoBuilder = new RepoBuilder(@"c:\temp\");
            var git         = repoBuilder.BuildEmptyRepo();

            repoBuilder.AddFile(@"FeatureVolvo\car.txt", "car");
            repoBuilder.AddFile(@"FeatureGarden\tree.txt", "tree");
            repoBuilder.AddFile(@"FeatureGarden\shovel.txt", "shovel");
            repoBuilder.AddFile(@"FeatureGarden\Suburb\grass.txt", "grass");
            string buf = "";

            git.FileSystemScanFolder(git.CodeFolder).Visit(x =>
            {
                if (x is TreeTreeLine t)
                {
                    buf += $"visittree {t.Path}\r\n";
                }
                if (x is BlobTreeLine b)
                {
                    buf += $"visitblob {b.Path}\r\n";
                }
            });

            Assert.Equal(@"visittree 
visittree FeatureGarden
visitblob FeatureGarden\shovel.txt
visitblob FeatureGarden\tree.txt
visittree FeatureGarden\Suburb
visitblob FeatureGarden\Suburb\grass.txt
visittree FeatureVolvo
visitblob FeatureVolvo\car.txt
", buf);
        }
Пример #3
0
        public void Given_two_toplevel_files_Then_()
        {
            repoBuilder = new RepoBuilder(@"c:\temp\");
            var git = repoBuilder.BuildEmptyRepo();

            repoBuilder.AddFile("car.txt", "car");
            repoBuilder.AddFile("door.txt", "door");

            var files = FileSystemScanFolder(git);

            Assert.Equal(@"tree 2 
blob car.txt
blob door.txt", files);
        }
Пример #4
0
        public void Given_two_files_in_subfolder_Then_()
        {
            repoBuilder = new RepoBuilder(@"c:\temp\");
            var git = repoBuilder.BuildEmptyRepo();

            repoBuilder.AddFile(@"FeatureVolvo\car.txt", "car");
            repoBuilder.AddFile(@"FeatureVolvo\door.txt", "door");

            var files = FileSystemScanFolder(git);

            Assert.Equal(
                @"tree 1 
tree 2 FeatureVolvo
blob FeatureVolvo\car.txt
blob FeatureVolvo\door.txt", files);
        }
Пример #5
0
 public void Given_no_remotes_When_listing_Then_return_empty()
 {
     Assert.Equal("", repoBuilder.BuildEmptyRepo().Remotes.List());
 }