Ejemplo n.º 1
0
        public void PrimeNumberService_GetPrimeNumbers()
        {
            //arrange
            var moqPrimeNumberService = new PrimeNumberService();
            int?number         = 3;
            var expectedResult = new int[] { 3, 2 };

            //act
            var sut = moqPrimeNumberService.GetPrimeNumbers(3);

            //assert
            Assert.AreEqual(expectedResult, sut);
        }
Ejemplo n.º 2
0
        public void PrimeNumberService_GetPrimeNumbers_Throw_ArgumentNullException()
        {
            //arrange
            var moqPrimeNumberService = new PrimeNumberService();
            int?number         = null;
            var expectedResult = new ArgumentNullException();

            //act
            var sut = Assert.Throws <ArgumentNullException>(
                () => moqPrimeNumberService.GetPrimeNumbers(null),
                "should throw ArgumentNullException");

            //assert
            Assert.AreEqual(expectedResult.InnerException, sut.InnerException);
        }
Ejemplo n.º 3
0
        public void PrimeNumberService_GetPrimeNumbers_Throw_ArgumentOutOfRangeException()
        {
            //arrange
            var moqPrimeNumberService = new PrimeNumberService();
            var number            = 1;
            var expectedException = new ArgumentOutOfRangeException();

            //act

            var sut = Assert.Throws <ArgumentOutOfRangeException>(
                () => moqPrimeNumberService.GetPrimeNumbers(1),
                "Should throw ArgumentOutOfRangeException");

            //assert
            Assert.AreEqual(expectedException.InnerException, sut.InnerException);
        }