Exemplo n.º 1
0
        public void Bundle_WithJustCommandButMissingFileName_ThrowsInvalidOperationException()
        {
            var command = new BundleCommand
            {
                Destination = "http://dummy/repo",
            };

            Assert.Throws <InvalidOperationException>(() => Repo1.Bundle(command));
        }
Exemplo n.º 2
0
        public void Bundle_UnrelatedDestinationRepository_ThrowsMercurialExecutionException()
        {
            Repo1.Init();
            WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true);

            Repo2.Init();
            WriteTextFileAndCommit(Repo2, "test2.txt", "dummy", "dummy", true);

            Assert.Throws <MercurialExecutionException>(() => Repo1.Bundle(GetTempFileName(), Repo2.Path));
        }
Exemplo n.º 3
0
        public void Unbundle_NoRepository_ThrowsMercurialExecutionException()
        {
            string bundleFileName = GetTempFileName();

            Repo1.Init();
            WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true);
            Repo1.Bundle(bundleFileName, new BundleCommand().WithAll());

            Assert.Throws <MercurialExecutionException>(() => Repo2.Unbundle(bundleFileName));
        }
Exemplo n.º 4
0
        public void Bundle_PulledIntoEmptyRepository_ProducesCloneOfSource()
        {
            string bundleFileName = GetTempFileName();

            Repo1.Init();
            WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true);

            Repo2.Init();

            Repo1.Bundle(bundleFileName, Repo2.Path);
            Repo2.Pull(bundleFileName);

            CollectionAssert.AreEqual(Repo1.Log(new LogCommand().WithIncludePathActions()), Repo2.Log(new LogCommand().WithIncludePathActions()));
        }
Exemplo n.º 5
0
        public void Bundle_DestinationIsEmpty_ProducesBundleFile()
        {
            string bundleFileName = GetTempFileName();

            Repo1.Init();
            WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true);

            Repo2.Init();

            Repo1.Bundle(bundleFileName, Repo2.Path);

            long length;

            using (var stream = new FileStream(bundleFileName, FileMode.Open))
            {
                length = stream.Length;
            }
            Assert.That(length, Is.GreaterThan(0));
        }
Exemplo n.º 6
0
        public void Bundle_DestinationIsACompleteClone_ThrowsNoChangesFoundMercurialExecutionExceptionAndLeavesFileAsIs()
        {
            string bundleFileName = GetTempFileName();

            Repo1.Init();
            WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true);

            Repo2.Clone(Repo1.Path);

            Assert.Throws <NoChangesFoundMercurialExecutionException>(() => Repo1.Bundle(bundleFileName, Repo2.Path));

            long length;

            using (var stream = new FileStream(bundleFileName, FileMode.Open))
            {
                length = stream.Length;
            }
            Assert.That(length, Is.EqualTo(0));
        }
Exemplo n.º 7
0
        public void Bundle_NoRepository_ThrowsMercurialExecutionException()
        {
            string tempFileName = GetTempFileName();

            Assert.Throws <MercurialExecutionException>(() => Repo1.Bundle(tempFileName));
        }
Exemplo n.º 8
0
        public void Bundle_NullOrEmptyDestination_ThrowsArgumentNullException(string input)
        {
            string tempFileName = Path.GetTempFileName();

            Assert.Throws <ArgumentNullException>(() => Repo1.Bundle(tempFileName, input));
        }
Exemplo n.º 9
0
 public void Bundle_NullOrEmptyFileName_ThrowsArgumentNullException(string input)
 {
     Assert.Throws <ArgumentNullException>(() => Repo1.Bundle(input, "http://dummy/repo"));
 }