Ejemplo n.º 1
0
    static VSGitExt CreateVSGitExt(IVSUIContext context = null, IGitExt gitExt = null, IAsyncServiceProvider sp = null,
                                   ILocalRepositoryModelFactory repoFactory = null, JoinableTaskContext joinableTaskContext = null)
    {
        context             = context ?? CreateVSUIContext(true);
        gitExt              = gitExt ?? CreateGitExt();
        sp                  = sp ?? Substitute.For <IAsyncServiceProvider>();
        repoFactory         = repoFactory ?? Substitute.For <ILocalRepositoryModelFactory>();
        joinableTaskContext = joinableTaskContext ?? new JoinableTaskContext();
        var factory = Substitute.For <IVSUIContextFactory>();

        factory.GetUIContext(UICONTEXT.RepositoryOpen_guid).Returns(context);
        sp.GetServiceAsync(typeof(IGitExt)).Returns(gitExt);
        var vsGitExt = new VSGitExt(sp, factory, repoFactory, joinableTaskContext);

        vsGitExt.JoinTillEmpty();
        return(vsGitExt);
    }
    static VSGitExt CreateVSGitExt(IVSUIContext context   = null, IGitExt gitExt = null, IServiceProvider sp = null,
                                   IGitService gitService = null, JoinableTaskContext joinableTaskContext = null, string contextGuidString = null)
    {
        context = context ?? CreateVSUIContext(true);
        gitExt  = gitExt ?? CreateGitExt();
        var contextGuid = new Guid(contextGuidString ?? Guids.GitSccProviderId);

        sp                  = sp ?? Substitute.For <IServiceProvider>();
        gitService          = gitService ?? Substitute.For <IGitService>();
        joinableTaskContext = joinableTaskContext ?? new JoinableTaskContext();
        var factory = Substitute.For <IVSUIContextFactory>();

        factory.GetUIContext(contextGuid).Returns(context);
        sp.GetService(typeof(IGitExt)).Returns(gitExt);
        var vsGitExt = new VSGitExt(sp, factory, gitService, joinableTaskContext);

        vsGitExt.JoinTillEmpty();
        return(vsGitExt);
    }