コード例 #1
0
        public void IsPrime_GivenAPrime_ReturnsTrue(int aPrimeNumber)
        {
            var hp             = new HappyPrimes();
            var actualResult   = hp.IsPrime(aPrimeNumber);
            var expectedResult = true;

            Assert.AreEqual(expectedResult, actualResult);
        }
コード例 #2
0
        public void IsPrime_GivenNonPrime_ReturnsFalse(int notAPrimeNumber)
        {
            var hp             = new HappyPrimes();
            var actualResult   = hp.IsPrime(notAPrimeNumber);
            var expectedResult = false;

            Assert.AreEqual(expectedResult, actualResult);
        }
コード例 #3
0
        public void IsPrime_GivenInvalidNonComposite_ThrowsException(int invalidNonComposite)
        {
            var hp = new HappyPrimes();

            Assert.Throws <ArithmeticException>(() => hp.IsPrime(invalidNonComposite));
        }