Esempio n. 1
0
        private static void DoWarmup()
        {
            var foo = Guid.NewGuid().ToString() + Environment.TickCount.ToString();

            stopwatch.Start();
            while (stopwatch.ElapsedMilliseconds < 2000)
            {
                Require.That(foo, "foo").IsNotNullOrEmpty();
                Require.That(() => foo).IsNotNullOrEmpty();
                RequireThat.NotNullOrEmpty(foo, "foo");
            }

            stopwatch.Stop();
        }
Esempio n. 2
0
        private static long[] RunSimpleTests()
        {
            Console.WriteLine("Running {0} iterations of {1} simple requirements each.", numberOfIterations, callsPerIteration);
            var results = new long[numberOfIterations];

            for (int i = 0; i < numberOfIterations; i++)
            {
                var foo = Guid.NewGuid().ToString() + Environment.TickCount.ToString();
                stopwatch.Reset();
                stopwatch.Start();
                for (int callCount = 0; callCount < callsPerIteration; callCount++)
                {
                    RequireThat.NotNullOrEmpty(foo, "foo");
                }

                stopwatch.Stop();
                results[i] = stopwatch.ElapsedTicks;
            }

            return(results);
        }
Esempio n. 3
0
 public void WhenNotEmptyEnumerable_DoesNotThrow()
 {
     RequireThat.NotNullOrEmpty(Enumerable.Range(1, 1), "name");
 }
Esempio n. 4
0
 public void WhenEmptyEnumerable_ThrowsException()
 {
     Assert.Throws <ArgumentException>(
         () => RequireThat.NotNullOrEmpty(Enumerable.Empty <object>(), "name"));
 }
Esempio n. 5
0
 public void WhenNullEnumerable_ThrowsException()
 {
     Assert.Throws <ArgumentNullException>(
         () => RequireThat.NotNullOrEmpty(null as IEnumerable, "name"));
 }
Esempio n. 6
0
 public void WhenNotEmptyString_DoesNotThrow()
 {
     RequireThat.NotNullOrEmpty("value", "name");
 }
Esempio n. 7
0
 public void WhenEmptyString_ThrowsException()
 {
     Assert.Throws <ArgumentException>(
         () => RequireThat.NotNullOrEmpty("", "name"));
 }
Esempio n. 8
0
 public void WhenNull_ThrowsException()
 {
     Assert.Throws <ArgumentNullException>(
         () => RequireThat.NotNullOrEmpty(null as string, "name"));
 }