PageRenderTime 48ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Mercurial.Net.Tests/PushTests.cs

#
C# | 59 lines | 49 code | 10 blank | 0 comment | 0 complexity | 000d118cf53f904de69daeee039bf8d8 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
  1. using System;
  2. using System.Linq;
  3. using NUnit.Framework;
  4. namespace Mercurial.Tests
  5. {
  6. [TestFixture]
  7. public class PushTests : DualRepositoryTestsBase
  8. {
  9. #region Setup/Teardown
  10. public override void SetUp()
  11. {
  12. base.SetUp();
  13. Repo1.Init();
  14. Repo2.Init();
  15. }
  16. #endregion
  17. [TestCase((string)null)]
  18. [TestCase("")]
  19. [TestCase(" \n\r\t")]
  20. [Test]
  21. [Category("API")]
  22. public void Push_WithNullOrEmptyDestination_ThrowsMercurialExecutionException(string destination)
  23. {
  24. Assert.Throws<ArgumentNullException>(() => Repo2.Push(destination));
  25. }
  26. [Test]
  27. [Category("Integration")]
  28. public void Push_IntoUnrelatedRepositoryWithForce_PushesSuccessfullyAndCreatesAnotherHead()
  29. {
  30. WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true);
  31. WriteTextFileAndCommit(Repo2, "test2.txt", "dummy", "dummy", true);
  32. Repo2.Push(
  33. Repo1.Path, new PushCommand
  34. {
  35. Force = true,
  36. });
  37. Changeset[] log = Repo1.Heads().ToArray();
  38. Assert.That(log.Length, Is.EqualTo(2));
  39. }
  40. [Test]
  41. [Category("Integration")]
  42. public void Push_IntoUnrelatedRepository_ThrowsMercurialExecutionException()
  43. {
  44. WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true);
  45. WriteTextFileAndCommit(Repo2, "test2.txt", "dummy", "dummy", true);
  46. Assert.Throws<MercurialExecutionException>(() => Repo2.Push(Repo1.Path));
  47. }
  48. }
  49. }