Exemplo n.º 1
0
        public void SetUp()
        {
            NPath.FileSystem =
                SubstituteFactory.CreateFileSystem(new CreateFileSystemOptions()
            {
                ChildFiles =
                    new Dictionary <SubstituteFactory.ContentsKey, IList <string> > {
                    {
                        new SubstituteFactory.ContentsKey(@"c:\Temp\.git\refs\heads", "*",
                                                          SearchOption.TopDirectoryOnly),
                        new[] { "master" }
                    }, {
                        new SubstituteFactory.ContentsKey(@"c:\Temp\.git\refs\heads\features", "*",
                                                          SearchOption.TopDirectoryOnly),
                        new[] { "feature1" }
                    },
                },
                ChildDirectories =
                    new Dictionary <SubstituteFactory.ContentsKey, IList <string> > {
                    {
                        new SubstituteFactory.ContentsKey(@"c:\Temp\.git\refs\heads", "*",
                                                          SearchOption.TopDirectoryOnly),
                        new[] { @"c:\Temp\.git\refs\heads\features" }
                    }, {
                        new SubstituteFactory.ContentsKey(@"c:\Temp\.git\refs\heads\features", "*",
                                                          SearchOption.TopDirectoryOnly),
                        new string[0]
                    },
                },
                FileContents =
                    new Dictionary <string, IList <string> > {
                    { @"c:\Temp\.git\HEAD", new[] { "ref: refs/heads/fixes/repository-manager-refresh" } }
                }
            });

            platform = SubstituteFactory.CreatePlatform();
            SynchronizationContext.SetSynchronizationContext(new TestSynchronizationContext());
            taskManager = new TaskManager(TaskScheduler.FromCurrentSynchronizationContext());
            repositoryPathConfiguration = new RepositoryPathConfiguration(@"/Temp".ToNPath());
            gitConfig = SubstituteFactory.CreateGitConfig();

            repositoryWatcher = SubstituteFactory.CreateRepositoryWatcher();

            gitConfigGetResults = new Dictionary <CreateRepositoryProcessRunnerOptions.GitConfigGetKey, string> {
                {
                    new CreateRepositoryProcessRunnerOptions.GitConfigGetKey("user.email", GitConfigSource.User),
                    "*****@*****.**"
                }, {
                    new CreateRepositoryProcessRunnerOptions.GitConfigGetKey("user.name", GitConfigSource.User),
                    "Someone Somewhere"
                }
            };
        }
Exemplo n.º 2
0
        private RepositoryWatcher CreateRepositoryWatcher(NPath path)
        {
            var paths = new RepositoryPathConfiguration(path);

            return(new RepositoryWatcher(Platform, paths, CancellationToken.None));
        }