Esempio n. 1
0
        public string DeleteCapeReview(int cape_id)
        {
            var errors = new List<string>();
            var repository = new CapeReviewRepository(this.entities);
            var service = new CapeReviewService(repository);
            service.DeleteCapeReview(cape_id, ref errors);

            if (errors.Count == 0)
            {
                return "successful cape review delete";
            }

            return "Failed cape review delete";
        }
Esempio n. 2
0
        public void DeleteCapeReviewTest()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<ICapeReviewRepository>();
            var capeReviewService = new CapeReviewService(mockRepository.Object);

            mockRepository.Setup(x => x.DeleteCapeReview(2, ref errors));

            //// Act
            capeReviewService.DeleteCapeReview(2, ref errors);

            //// Assert
            mockRepository.Verify(x => x.DeleteCapeReview(2, ref errors), Times.Once());
        }
Esempio n. 3
0
        public void DeleteCapeReviewErrorTest()
        {
            //// Arrange
            var errors = new List<string>();

            var mockRepository = new Mock<ICapeReviewRepository>();
            var capeReviewService = new CapeReviewService(mockRepository.Object);
             int? nullInt = null; // (int)nullInt

            //// Act
             capeReviewService.DeleteCapeReview((int)nullInt, ref errors);

            //// Assert capeReview id cannot be null
            Assert.AreEqual(1, errors.Count);
        }