public void IActionConstraint_InitializesCorrectValues() { // Arrange var constraint = new TestConstraint(); // Act var constraintValues = new ActionConstraintValues(constraint); // Assert Assert.True(constraintValues.IsConstraint); Assert.False(constraintValues.IsFactory); Assert.Equal(23, constraintValues.Order); Assert.Equal(typeof(TestConstraint), constraintValues.ActionConstraintMetadataType); }
public Performance GetPerformance(TestConstraint testConstraints) { var soe = new PrimeTime.SieveOfEratosthenes(testConstraints.Limit); Stopwatch sw = Stopwatch.StartNew(); var primes = soe.Primes.ToList(); sw.Stop(); return new Performance { RangeLimit = testConstraints.Limit, NoPrimesFound = primes.LongCount(), LastPrimeFound = primes.LastOrDefault(), TimeTaken = sw.ElapsedMilliseconds }; }
public Performance GetPerformance(TestConstraint testConstraints) { var trialDivison = new TrialDivisionByPrimes(); Stopwatch sw = Stopwatch.StartNew(); var primes = trialDivison.Primes.TakeWhile(p => p <= testConstraints.Limit).ToList(); sw.Stop(); return new Performance { RangeLimit = testConstraints.Limit, NoPrimesFound = primes.LongCount(), LastPrimeFound = primes.LastOrDefault(), TimeTaken = sw.ElapsedMilliseconds }; }