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(); }
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); }
public void WhenNotEmptyEnumerable_DoesNotThrow() { RequireThat.NotNullOrEmpty(Enumerable.Range(1, 1), "name"); }
public void WhenEmptyEnumerable_ThrowsException() { Assert.Throws <ArgumentException>( () => RequireThat.NotNullOrEmpty(Enumerable.Empty <object>(), "name")); }
public void WhenNullEnumerable_ThrowsException() { Assert.Throws <ArgumentNullException>( () => RequireThat.NotNullOrEmpty(null as IEnumerable, "name")); }
public void WhenNotEmptyString_DoesNotThrow() { RequireThat.NotNullOrEmpty("value", "name"); }
public void WhenEmptyString_ThrowsException() { Assert.Throws <ArgumentException>( () => RequireThat.NotNullOrEmpty("", "name")); }
public void WhenNull_ThrowsException() { Assert.Throws <ArgumentNullException>( () => RequireThat.NotNullOrEmpty(null as string, "name")); }