Example #1
0
        public void Copy_ReposCopy()
        {
            SvnSandBox sbox     = new SvnSandBox(this);
            Uri        reposUri = sbox.CreateRepository(SandBoxRepository.Default);
            Uri        trunk    = new Uri(reposUri, "trunk/");
            Uri        branch   = new Uri(reposUri, "my-branches/new-branch");

            SvnCopyArgs ca = new SvnCopyArgs();

            ca.LogMessage    = "Message";
            ca.CreateParents = true;
            Client.RemoteCopy(trunk, branch, ca);

            int n = 0;

            Client.List(branch, delegate(object sender, SvnListEventArgs e)
            {
                if (e.Entry.NodeKind == SvnNodeKind.File)
                {
                    n++;
                }
            });

            Assert.That(n, Is.GreaterThan(0), "Copied files");
        }
Example #2
0
        private static void ValidateMultiAss <TAsserter, TException>()
            where TAsserter : MultipleAsserter <TAsserter, object>, new()
            where TException : Exception
        {
            var asserter = new TAsserter()
                           .Against(9)
                           .And(Is.GreaterThan(100))
                           .And(() => Assert.Ignore("IGNORED"))
                           .And(() => throw new NullReferenceException())
                           .And(Is.Null);

            Assert.Throws <TException>(asserter.Invoke);
        }
Example #3
0
        public void FrameTimeNowDoesntChangeWithinFrame(
            [ValueSource(nameof(RealTimes))]
            double secondsToSleep
            )
        {
            Assume.That(secondsToSleep, Is.GreaterThan(0), $"We must {nameof(Thread.Sleep)} for a positive duration in order to get accurate results!");

            var startNow = FrameTime.Now;

            Thread.Sleep(TimeSpan.FromSeconds(secondsToSleep));

            Assert.That(FrameTime.Now, Is.EqualTo(startNow));
            Assert.That(FrameTime.Now, Is.Not.Approximately(DateTime.Now));
        }
Example #4
0
 public void AssumeAll_WithFailures()
 {
     Assert.Throws <InconclusiveException>(
         () =>
         AssumeAll.Of(
             5,
             Is.EqualTo("b"),
             Is.Zero,
             Is.GreaterThan(double.MinValue),
             Has.Member("yolo"),
             Is.EqualTo(2)
             )
         );
 }
        public void TestGetHashCode()
        {
            var testCases =
                new[]
            {
                // Select thinking code path and considerable values
                new byte[0],
                new byte[] { 1 },
                new byte[] { 2 },
                new byte[] { 1, 2 },
                new byte[] { 1, 3 },
                new byte[] { 1, 2, 3, 4 },
                new byte[] { 1, 2, 3, 5 },
                Enumerable.Range(1, 8).Select(i => ( byte )i).ToArray(),
                Enumerable.Range(1, 8).Select(i => ( byte )i).Reverse().ToArray(),
                Enumerable.Range(1, 16).Select(i => ( byte )i).ToArray(),
                Enumerable.Range(1, 16).Select(i => ( byte )i).Reverse().ToArray(),
                Enumerable.Range(1, 32).Select(i => ( byte )i).ToArray(),
                Enumerable.Range(1, 32).Select(i => ( byte )i).Reverse().ToArray(),
            };
            var result = new HashSet <int>();

            foreach (var testCase in testCases)
            {
                foreach (var typeCode in new byte[] { 0, 1 })
                {
                    checked
                    {
                        result.Add(new MessagePackExtendedTypeObject(typeCode, testCase).GetHashCode());
                    }
                }
            }

            // Check variance
            Assert.That(result.Count, Is.GreaterThan(testCases.Length * 2 * 0.6));
        }
 public static void should_be_greater_than(this IComparable actual, IComparable baseline)
 {
     Assert.That(actual, Is.GreaterThan(baseline));
 }
Example #7
0
 public static void Greater(int expected, int actual, string message, params object[] args)
 {
     Assert.That(expected, Is.GreaterThan(actual), message, args);
 }
Example #8
0
 public static void Greater(double expected, double actual)
 {
     Assert.That(expected, Is.GreaterThan(actual));
 }
Example #9
0
 public static void Greater(double expected, double actual, string message)
 {
     Assert.That(expected, Is.GreaterThan(actual), message, null);
 }
Example #10
0
 public static void Greater(int expected, int actual)
 {
     Assert.That(expected, Is.GreaterThan(actual));
 }
Example #11
0
        public void Copy_CopyTest()
        {
            SvnSandBox sbox = new SvnSandBox(this);

            sbox.Create(SandBoxRepository.Default);

            string WcPath = sbox.Wc;
            Uri    WcUri  = sbox.Uri;

            using (SvnClient client = NewSvnClient(true, false))
            {
                string file = Path.Combine(WcPath, "CopyBase");

                TouchFile(file);
                client.Add(file);

                client.Commit(WcPath);

                client.RemoteCopy(new Uri(WcUri, "CopyBase"), new Uri(WcUri, "RemoteCopyBase"));
                bool visited = false;
                bool first   = true;
                client.Log(new Uri(WcUri, "RemoteCopyBase"), delegate(object sender, SvnLogEventArgs e)
                {
                    if (first)
                    {
                        first = false;
                        foreach (SvnChangeItem i in e.ChangedPaths)
                        {
                            Assert.That(i.Path, Does.EndWith("trunk/RemoteCopyBase"), "Path ends with folder/RemoteCopyBase");
                            Assert.That(i.Action, Is.EqualTo(SvnChangeAction.Add));
                            Assert.That(i.CopyFromPath, Does.EndWith("trunk/CopyBase"), "CopyFromPath ends with folder/CopyBase");
                            Assert.That(i.CopyFromRevision, Is.GreaterThan(0L));
                            Assert.That(i.NodeKind, Is.EqualTo(SvnNodeKind.File));
                        }
                    }
                    else
                    {
                        foreach (SvnChangeItem i in e.ChangedPaths)
                        {
                            Assert.That(i.Action, Is.EqualTo(SvnChangeAction.Add));
                            Assert.That(i.Path, Does.EndWith("trunk/CopyBase"), "Path ends with folder/CopyBase");
                            Assert.That(i.NodeKind, Is.EqualTo(SvnNodeKind.File));
                            visited = true;
                        }
                    }
                });
                Assert.That(visited, "Visited log item");

                client.Copy(new SvnPathTarget(file), Path.Combine(WcPath, "LocalCopy"));
                client.Commit(WcPath);
                visited = false;
                first   = true;
                client.Log(new Uri(WcUri, "LocalCopy"), delegate(object sender, SvnLogEventArgs e)
                {
                    if (first)
                    {
                        foreach (SvnChangeItem i in e.ChangedPaths)
                        {
                            Assert.That(i.Path, Does.EndWith("trunk/LocalCopy"), "Path ends with folder/LocalCopy");
                            Assert.That(i.Action, Is.EqualTo(SvnChangeAction.Add));
                            Assert.That(i.CopyFromPath, Does.EndWith("trunk/CopyBase"), "CopyFromPath ensd with folder/CopyBase");
                            Assert.That(i.CopyFromRevision, Is.GreaterThan(0L));
                        }
                        first = false;
                    }
                    else
                    {
                        foreach (SvnChangeItem i in e.ChangedPaths)
                        {
                            Assert.That(i.Action, Is.EqualTo(SvnChangeAction.Add));
                            Assert.That(i.Path, Does.EndWith("trunk/CopyBase"), "Path ends with folder/CopyBase");
                            visited = true;
                        }
                    }
                });
                Assert.That(visited, "Visited local log item");
            }
        }