-
Notifications
You must be signed in to change notification settings - Fork 5k
/
PrimeServiceTests.cs
33 lines (28 loc) · 1.01 KB
/
PrimeServiceTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Numbers;
using Xunit;
namespace XUnit.Coverlet
{
public class PrimeServiceTests
{
readonly PrimeService _primeService;
public PrimeServiceTests() => _primeService = new PrimeService();
[
Theory,
InlineData(-1), InlineData(0), InlineData(1)
]
public void IsPrime_ValuesLessThan2_ReturnFalse(int value) =>
Assert.False(_primeService.IsPrime(value), $"{value} should not be prime");
[
Theory,
InlineData(2), InlineData(3), InlineData(5), InlineData(7)
]
public void IsPrime_PrimesLessThan10_ReturnTrue(int value) =>
Assert.True(_primeService.IsPrime(value), $"{value} should be prime");
[
Theory,
InlineData(4), InlineData(6), InlineData(8), InlineData(9)
]
public void IsPrime_NonPrimesLessThan10_ReturnFalse(int value) =>
Assert.False(_primeService.IsPrime(value), $"{value} should not be prime");
}
}