예제 #1
0
        public void SetupTest()
        {
            _redirector              = new MockRedirector();
            _gitClient               = new MockGitClient();
            _gitHubClient            = new MockGitHubClient();
            _cutterClient            = new MockCookiecutterClient();
            _installedTemplateSource = new MockTemplateSource();
            _gitHubTemplateSource    = new MockTemplateSource();
            _feedTemplateSource      = new MockTemplateSource();
            _projectSystemClient     = new MockProjectSystemClient();

            var output = TestData.GetTempPath();
            var outputProjectFolder = Path.Combine(output, "project");

            _telemetry = new CookiecutterTelemetry(new TelemetryTestService());
            CookiecutterTelemetry.Initialize(_telemetry.TelemetryService);
            _vm = new CookiecutterViewModel(
                _cutterClient,
                _gitHubClient,
                _gitClient,
                _telemetry,
                _redirector,
                _installedTemplateSource,
                _feedTemplateSource,
                _gitHubTemplateSource,
                null,
                _projectSystemClient
                )
            {
                UserConfigFilePath = UserConfigFilePath,
                OutputFolderPath   = outputProjectFolder
            };
        }
예제 #2
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize() {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            UIThread.EnsureService(this);

            _projectSystem = new ProjectSystemClient(DTE);

            CookiecutterTelemetry.Initialize();
        }
예제 #3
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine("Entering Initialize() of: {0}".FormatInvariant(this));
            base.Initialize();

            UIThread.EnsureService(this);

            _projectSystem = new ProjectSystemClient(DTE);

            CookiecutterTelemetry.Initialize();
        }
예제 #4
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            UIThread.EnsureService(this);

            CookiecutterTelemetry.Initialize();

            RegisterCommands(new Command[] {
                new CookiecutterExplorerCommand(),
                new CreateFromCookiecutterCommand(),
                new AddFromCookiecutterCommand(),
            }, PackageGuids.guidCookiecutterCmdSet);
        }
예제 #5
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            Trace.WriteLine("Entering {0}.InitializeAsync()".FormatInvariant(this));

            await base.InitializeAsync(cancellationToken, progress);

            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            if (GetService(typeof(UIThreadBase)) == null)
            {
                ((IServiceContainer)this).AddService(typeof(UIThreadBase), new UIThread(JoinableTaskFactory), true);
            }

            CookiecutterTelemetry.Initialize();

            _projectSystem = new ProjectSystemClient(DTE);
            Trace.WriteLine("Leaving {0}.InitializeAsync()".FormatInvariant(this));
        }
        public void SetupTest()
        {
            _redirector = new MockRedirector();

            var output = TestData.GetTempPath();
            var outputProjectFolder = Path.Combine(output, "integration");
            var feedUrl             = new Uri(TestFeedPath);
            var installedPath       = TestInstalledTemplateFolderPath;
            var userConfigFilePath  = TestUserConfigFilePath;

            _gitClient    = GitClientProvider.Create(_redirector, null);
            _gitHubClient = new GitHubClient();
            _cutterClient = CookiecutterClientProvider.Create(null, _redirector);
            _telemetry    = new CookiecutterTelemetry(new TelemetryTestService());
            CookiecutterTelemetry.Initialize(_telemetry.TelemetryService);
            _installedTemplateSource = new LocalTemplateSource(installedPath, _gitClient);
            _gitHubTemplateSource    = new GitHubTemplateSource(_gitHubClient);
            _feedTemplateSource      = new FeedTemplateSource(feedUrl);
            _projectSystemClient     = new MockProjectSystemClient();

            _vm = new CookiecutterViewModel(
                _cutterClient,
                _gitHubClient,
                _gitClient,
                _telemetry,
                _redirector,
                _installedTemplateSource,
                _feedTemplateSource,
                _gitHubTemplateSource,
                ExecuteCommand,
                _projectSystemClient
                )
            {
                UserConfigFilePath = userConfigFilePath
            };
            ((CookiecutterClient)_cutterClient).DefaultBasePath = outputProjectFolder;
        }