public void IsPrimeNumberAsync_number_is_prime_should_return_true(int[] values) { var service = new PrimeNumberService(mockLogger.Object); values.ToList().ForEach(value => { var result = service.IsPrimeNumberAsync(value).GetAwaiter().GetResult(); Assert.IsTrue(result); }); }
public void IsPrimeNumberAsync_number_is_below_or_equel_one_should_throw_exception(int[] values) { var service = new PrimeNumberService(mockLogger.Object); values.ToList().ForEach(value => { var exception = Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => service.IsPrimeNumberAsync(value)); Assert.AreEqual(exception.Message, "Specified argument was out of the range of valid values. (Parameter 'Prime number')"); }); }