Exemplo n.º 1
0
        public void Remote_ListLocks()
        {
            SvnSandBox sbox     = new SvnSandBox(this);
            Uri        tmpRepos = sbox.CreateRepository(SandBoxRepository.Greek);

            using (SvnRemoteSession rs = new SvnRemoteSession())
            {
                rs.Open(tmpRepos);

                int n = 0;
                rs.ListLocks("",
                             delegate(object sender, SvnRemoteListLockEventArgs e)
                {
                    n++;
                });

                Assert.That(n, Is.EqualTo(0));
            }

            using (SvnClient cl = new SvnClient())
            {
                cl.RemoteLock(new Uri(tmpRepos, "trunk/iota"), "");
                cl.RemoteLock(new Uri(tmpRepos, "trunk/A/D/gamma"), "");
            }

            using (SvnRemoteSession rs = new SvnRemoteSession())
            {
                rs.Open(tmpRepos);

                int n = 0;
                rs.ListLocks("trunk/A",
                             delegate(object sender, SvnRemoteListLockEventArgs e)
                {
                    n++;
                });

                Assert.That(n, Is.EqualTo(1));

                n = 0;
                rs.ListLocks("trunk",
                             delegate(object sender, SvnRemoteListLockEventArgs e)
                {
                    n++;
                });

                Assert.That(n, Is.EqualTo(2));
            }
        }
Exemplo n.º 2
0
        public void Remote_Lock()
        {
            SvnSandBox sbox     = new SvnSandBox(this);
            Uri        reposUri = sbox.CreateRepository(SandBoxRepository.MergeScenario);
            Uri        toLock   = new Uri(reposUri, "trunk/index.html");

            Client.RemoteLock(toLock, "");

            using (SvnRemoteSession rc = new SvnRemoteSession())
            {
                bool locked = false;
                rc.Open(reposUri);
                rc.ListLocks("",
                             delegate(object sender, SvnRemoteListLockEventArgs e)
                {
                    Assert.That(e.Lock, Is.Not.Null);
                    Assert.That(e.Path, Is.EqualTo("trunk/index.html"));
                    Assert.That(e.RepositoryPath, Is.EqualTo("trunk/index.html"));
                    Assert.That(e.Uri, Is.EqualTo(toLock));
                    locked = true;
                });

                Assert.That(locked, Is.True);
            }

            using (SvnRemoteSession rc = new SvnRemoteSession())
            {
                bool locked = false;
                rc.Open(new Uri(reposUri, "trunk"));
                rc.ListLocks("",
                             delegate(object sender, SvnRemoteListLockEventArgs e)
                {
                    Assert.That(e.Lock, Is.Not.Null);
                    Assert.That(e.Path, Is.EqualTo("index.html"));
                    Assert.That(e.RepositoryPath, Is.EqualTo("trunk/index.html"));
                    Assert.That(e.Uri, Is.EqualTo(toLock));
                    locked = true;
                });

                Assert.That(locked, Is.True);
            }
        }