Example #1
0
        public void TrackFailureLoadingChangeset()
        {
            long changesetId = 123;

            string message = "someMessage";
            string stacktrace = "    at Foo\n    at Bar";
            FakeException someException = new FakeException(message, stacktrace);

            TfsFailTracker sut = new TfsFailTracker();

            sut.TrackFailureLoadingChangeset(changesetId, someException);

            var results = sut.GetSummary();

            string expectedResult =   "Error loading changeset " + changesetId.ToString() + "\r\n" +
                                      "    Message: " + message + "\r\n" +
                                      "        at Foo\r\n" +
                                      "        at Bar\r\n";
            Assert.AreEqual(
                expectedResult, results);
        }
Example #2
0
        public IEnumerable<ITfsChangeset> GetAllChangesetsStartingAt(long startChangeset, TfsFailTracker failTracker)
        {
            long position = startChangeset;
            Changeset changeset = null;

            do
            {
                try
                {
                    changeset = VersionControl.GetChangeset((int) position, true, true);
                }
                catch(Exception e)
                {
                    if (TfsFailTracker.ShouldHaltOnError(e))
                        throw;

                    failTracker.TrackFailureLoadingChangeset(position, e);
                }

                if (changeset != null)
                    yield return new TfsChangeset(this, changeset)
                    {
                        Summary = new TfsChangesetInfo { ChangesetId = changeset.ChangesetId }
                    };

                position++;

            } while (changeset != null);
        }