コード例 #1
0
        protected override void Setup(bool usePrivateRepo)
        {
            // re-use test repo for GithubApi tests
            this.source          = new ConfigSource();
            this.source.Hoster   = "github";
            this.source.Type     = "user";
            this.source.Name     = this.GetUserName(usePrivateRepo);
            this.source.AuthName = TestHelper.EnvVar("Github_Name");
            this.source.Password = TestHelper.EnvVar("Github_PW");

            var config = new Config();

            config.Sources.Add(this.source);

            var context = new FakeContext();

            context.Config = config;

            var factory = new FakeScmFactory();

            factory.Register(ScmType.Git, new GitScm(new FileSystemHelper(), context));

            var api = new GithubApi(context, factory);

            this.repoList = api.GetRepositoryList(this.source);
            this.repo     = this.repoList.Find(r => r.ShortName == this.GetRepoName(usePrivateRepo));

            this.scm = new GitScm(new FileSystemHelper(), context);
            Assert.True(this.scm.IsOnThisComputer());

            var scmFactory = new FakeScmFactory();

            scmFactory.Register(ScmType.Git, this.scm);
            this.sut = new GithubBackup(scmFactory);
        }