Hello mates!
I have one problem with Math Utility Test for PrimeNumber case.
The code is:
public bool IsPrimeNumber(int n)
{
int i = 0, num = 0;
while (i <= n)
{
if ((n % i) == 0) num = num + 1;
i = i + 1;
}
if (num == 0)
return true;
else
return false;
}
But I'm not sure if its the correct code for prime numbers.
&
The test method should be what?:
[TestMethod]
public void Test_IsPrimeNumber()
{
bool result = this.IsPrimeNumber(?);
Assert.AreEqual(?, result);
}
It needs to be Passed when you run Test in Solution.
Suggestions are welcome.
Regards!