Exemplo n.º 1
0
        public void TestPasServiceDeleteInvalidPas()
        {
            var service    = new PasService(unitOfWork.Object);
            int idToDelete = 99;

            Assert.Throws <Exception>(() => service.Delete(idToDelete));
            unitOfWork.Verify(s => s.PasRepository.Delete(idToDelete), Times.Never);
            unitOfWork.Verify(s => s.Save(), Times.Never);
        }
Exemplo n.º 2
0
        public void TestPasServiceDeletePas()
        {
            var service    = new PasService(unitOfWork.Object);
            int idToDelete = 1;

            service.Delete(idToDelete);
            var result    = unitOfWork.Object.PasRepository.FindById(idToDelete);
            var listaPasa = unitOfWork.Object.PasRepository.GetAll();

            Assert.Null(result);
            Assert.DoesNotContain(listaPasa, x => x.Id == idToDelete);
            unitOfWork.Verify(s => s.PasRepository.Delete(idToDelete), Times.Once);
            unitOfWork.Verify(s => s.Save(), Times.Once);
        }