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

            ChangeType changeType = ChangeType.Rename;
            string serverPath = @"$\tfs\some\file.cs";
            string reason = "unable to delete rename source";

            TfsFailTracker sut = new TfsFailTracker();

            sut.TrackFailureLoadingChange(changesetId, changeType, serverPath, reason);

            var results = sut.GetSummary();

            var expectedResult =
                "Error loading changeset " + changesetId.ToString() + "\r\n" +
                "    " + reason + " for Rename of " + serverPath + "\r\n";

            Assert.AreEqual(expectedResult, results);
        }
Example #2
0
        public void InitiallyEmpty()
        {
            TfsFailTracker sut = new TfsFailTracker();

            var errorNotes = sut.GetSummary();

            Assert.AreEqual(null, errorNotes);
        }
Example #3
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 #4
0
        void FlushFailRecordsToNote(string commit, TfsFailTracker failTracker)
        {
            string failRecord = failTracker.GetSummary();

            if (failRecord != null)
            {
                string note = Repository.GetNote(commit);

                if (note == null)
                    note = failRecord;
                else
                    note = note + "\n" + failRecord;

                Repository.SetNote(commit, note);

                failTracker.Reset();
            }
        }