Ejemplo n.º 1
0
        private void TriggerOutputReceivedEvent(DataReceivedEventArgs e)
        {
            if (StandardOutputReceived != null)
            {
                var args = new OutputReceivedArgs(e);

                StandardOutputReceived(args);
            }
        }
Ejemplo n.º 2
0
        private void TriggerErrorReceivedEvent(DataReceivedEventArgs e)
        {
            if (ErrorOutputReceived != null)
            {
                var args = new OutputReceivedArgs(e);

                ErrorOutputReceived(args);
            }
        }
Ejemplo n.º 3
0
        private void TriggerOutputReceivedEvent(DataReceivedEventArgs e)
        {
            if (StandardOutputReceived != null)
            {
                var args = new OutputReceivedArgs(e);

                StandardOutputReceived(args);
            }
        }
Ejemplo n.º 4
0
        private void TriggerErrorReceivedEvent(DataReceivedEventArgs e)
        {
            if (ErrorOutputReceived != null)
            {
                var args = new OutputReceivedArgs(e);

                ErrorOutputReceived(args);
            }
        }
Ejemplo n.º 5
0
        public void WhenCloningARepositoryTheProgressIsProvided()
        {
            MockGitLocationForConfiguration();

            Command command = MockCommandProperties();

            Runner runner = MockRunner();

            Mocks.ReplayAll();

            var clone = new CloneCommand
                            {
                                ProjectLocation = GitTestProjectLocation,
                                RepositoryToClone = GitTestProjectLocation,
                                Destination = RepositoryDestination,
                                Runner = runner,
                                CommandArguments = command,
                                EnvironmentVariable = StubEnvironmentVariable()
                            };

            string progressMessage = string.Empty;
            bool messageRecieved = false;

            clone.Progress += (s, e) =>
                                  {
                                      if (!messageRecieved)
                                      {
                                          progressMessage = e.Message;
                                          messageRecieved = true;
                                      }
                                  };

            clone.Run();

            var eventArgs = new OutputReceivedArgs
                                {
                                    Data = "This is a progress message"
                                };

            runner.Raise(v => v.ErrorOutputReceived += null, eventArgs);

            Stopwatch watch = Stopwatch.StartNew();

            while (!messageRecieved && watch.Elapsed < TimeSpan.FromMilliseconds(500))
            {
                Thread.Sleep(1);
            }

            Assert.That(messageRecieved);
            Assert.That(progressMessage.StartsWith("This is a progress message"));
        }
Ejemplo n.º 6
0
        private void ErrorOutputReceivedFromRunner(OutputReceivedArgs obj)
        {
            if (Progress != null)
            {
                var args = new GitCommandProgressEventArgs
                               {
                                   Message = obj.Data
                               };

                Progress(this, args);
            }
        }