Exemplo n.º 1
0
 public void SecondCheckin_Invalid_BacksOut()
 {
     using (var bob = new RepositorySetup("bob"))
     {
         bob.AddAndCheckinFile("test.chorusTest", "hello");
         bob.ChangeFile("test.chorusTest", ChorusTestFileHandler.GetInvalidContents());
         using (var cop = new CommitCop(bob.Repository, ChorusFileTypeHandlerCollection.CreateWithTestHandlerOnly(), bob.Progress))
         {
             Assert.That(cop.ValidationResult, Is.Not.Null.And.Not.Empty);
             bob.Repository.Commit(false, "bad data");
         }
         Debug.WriteLine(bob.Repository.GetLog(-1));
         bob.AssertHeadCount(1);
         bob.AssertLocalRevisionNumber(2);
         bob.AssertFileContents("test.chorusTest", "hello");
     }
 }
Exemplo n.º 2
0
 public void InitialFileCommit_Invalid_BacksOut()
 {
     using (var bob = new RepositorySetup("bob"))
     {
         bob.AddAndCheckinFile("validfile.chorustest", "valid contents");
         bob.ChangeFile("test.chorusTest", ChorusTestFileHandler.GetInvalidContents());
         using (var cop = new CommitCop(bob.Repository, ChorusFileTypeHandlerCollection.CreateWithTestHandlerOnly(), bob.Progress))
         {
             bob.Repository.AddAndCheckinFile("test.chorusTest");
             Assert.That(cop.ValidationResult, Does.Contain("Failed"));
         }
         Debug.WriteLine(bob.Repository.GetLog(-1));
         bob.AssertHeadCount(1);
         bob.AssertLocalRevisionNumber(2);
         bob.AssertFileDoesNotExistInRepository("test.chorusTest");
         bob.AssertFileExistsInRepository("validfile.chorustest");
     }
 }
Exemplo n.º 3
0
        public void VeryFirstCommit_Invalid_Throws()
        {
            string validationResult = null;

            Assert.Throws <ApplicationException>(() =>
            {
                using (var bob = new RepositorySetup("bob"))
                {
                    bob.ChangeFile("test.chorusTest", ChorusTestFileHandler.GetInvalidContents());
                    using (var cop = new CommitCop(bob.Repository, ChorusFileTypeHandlerCollection.CreateWithTestHandlerOnly(), bob.Progress))
                    {
                        bob.Repository.AddAndCheckinFile("test.chorusTest");
                        // ReSharper disable once ReturnValueOfPureMethodIsNotUsed - SUT
                        validationResult = cop.ValidationResult;
                    }
                }
            });
            Assert.That(validationResult, Does.Contain("Failed"));
        }
 public void Sync_ModifiedFileIsInvalid_CheckedInButThenBackedOut()
 {
     /*
      *      @  changeset:   2
      |  summary:     [Backout due to validation Failure]
      |
      |      o  changeset:   1
      |  summary:     missing checkin description
      |
      |      o  changeset:   0
      |      summary:     Add test.chorusTest
      */
     using (var bob = new RepositorySetup("bob"))
     {
         bob.AddAndCheckinFile("test.chorusTest", "original");
         bob.AssertLocalRevisionNumber(0);
         bob.ChangeFile("test.chorusTest", ChorusTestFileHandler.GetInvalidContents());
         bob.CheckinAndPullAndMerge();
         bob.AssertLocalRevisionNumber(2);
         bob.AssertHeadCount(1);
         bob.AssertLocalRevisionNumber(int.Parse(bob.Repository.GetTip().Number.LocalRevisionNumber));
         Debug.WriteLine(bob.Repository.GetLog(-1));
     }
 }