Example #1
0
        public void Authentication_SimpleSslCert()
        {
            using (SvnClient client = new SvnClient())
            {
                client.Authentication.Clear();
                client.Authentication.SslServerTrustHandlers   += Authenticator_SslServerTrustHandlers;
                client.Authentication.UserNamePasswordHandlers += Authenticator_UserNamePasswordHandlers;
                bool        arrived = false;
                SvnInfoArgs a       = new SvnInfoArgs();
                a.ThrowOnCancel = false;
                a.ThrowOnError  = false;

                Assert.That(client.Info(new Uri("https://svn.apache.org/repos/private/committers"), a,
                                        delegate(object sender, SvnInfoEventArgs e)
                {
                    arrived = true;
                }), Is.False);

                Assert.That(a.LastException, Is.Not.Null);
                Assert.That(a.LastException, Is.InstanceOf(typeof(SvnException)));
                Assert.That(arrived, Is.False);
                Assert.That(_serverTrustTicked);
                Assert.That(_userNamePasswordTicked);

                Assert.That(_userArgs, Is.Not.Null);
                Assert.That(_userArgs.InitialUserName, Is.Not.Null);
                Assert.That(_userArgs.Realm, Is.EqualTo("<https://svn.apache.org:443> ASF Members"));
                Assert.That(_userArgs.RealmUri, Is.EqualTo(new Uri("https://svn.apache.org/")));
            }
        }
Example #2
0
        public void Exception_StatusCrash()
        {
            SvnSandBox sbox = new SvnSandBox(this);

            sbox.Create(SandBoxRepository.Default);

            SvnStatusArgs sa = new SvnStatusArgs();

            sa.ThrowOnError       = false;
            sa.RetrieveAllEntries = true;
            Assert.That(Client.Status(sbox.Wc, sa,
                                      delegate(object sender, SvnStatusEventArgs e)
            {
                throw new InvalidOperationException();
            }), Is.False);

            Assert.That(sa.LastException.RootCause, Is.InstanceOf(typeof(InvalidOperationException)));
        }
Example #3
0
        public void Path_ParsePaths()
        {
            SvnUriTarget  ut;
            SvnPathTarget pt;
            SvnTarget     st;

            Assert.That(SvnUriTarget.TryParse("http://svn.apache.org/repos/asf/subversion/", out ut));
            Assert.That(ut.Revision, Is.EqualTo(SvnRevision.None));
            Assert.That(SvnUriTarget.TryParse("http://svn.apache.org/repos/asf/subversion/@123", out ut));
            Assert.That(ut.Revision, Is.EqualTo(SvnRevision.None));
            Assert.That(ut.TargetName.Contains("@"));
            Assert.That(SvnUriTarget.TryParse("http://svn.apache.org/repos/asf/subversion/@123", true, out ut));
            Assert.That(ut.Revision, Is.EqualTo((SvnRevision)123L));

            Assert.That(SvnPathTarget.TryParse("C:\\A", out pt));
            Assert.That(pt.Revision, Is.EqualTo(SvnRevision.None));
            Assert.That(SvnPathTarget.TryParse("C:\\A@123", out pt));
            Assert.That(pt.Revision, Is.EqualTo(SvnRevision.None));
            Assert.That(pt.TargetName.Contains("@"));
            Assert.That(SvnPathTarget.TryParse("C:\\@123", true, out pt));
            Assert.That(pt.Revision, Is.EqualTo((SvnRevision)123L));

            Assert.That(SvnTarget.TryParse("http://svn.apache.org/repos/asf/subversion/", out st));
            Assert.That(st, Is.InstanceOf(typeof(SvnUriTarget)));
            Assert.That(SvnTarget.TryParse("http://svn.apache.org/repos/asf/subversion/@123", out st));
            Assert.That(st, Is.InstanceOf(typeof(SvnUriTarget)));
            Assert.That(SvnTarget.TryParse("http://svn.apache.org/repos/asf/subversion/@123", true, out st));
            Assert.That(st, Is.InstanceOf(typeof(SvnUriTarget)));

            Assert.That(SvnTarget.TryParse("C:\\A", out st));
            Assert.That(st, Is.InstanceOf(typeof(SvnPathTarget)));
            Assert.That(SvnTarget.TryParse("C:\\A@123", out st));
            Assert.That(st, Is.InstanceOf(typeof(SvnPathTarget)));
            Assert.That(SvnTarget.TryParse("C:\\@123", true, out st));
            Assert.That(st, Is.InstanceOf(typeof(SvnPathTarget)));
        }