Beispiel #1
0
        public void TestAngazovanjeServiceDeleteInvalid()
        {
            var service = new AngazovanjeService(unitOfWork.Object);
            // pasId is invalid id
            var toDelete = unitOfWork.Object.AngazovanjeRepository.GetById(100, 1);

            Assert.Throws <Exception>(() => service.Delete(toDelete));
            unitOfWork.Verify(s => s.AngazovanjeRepository.Delete(toDelete), Times.Never);
            unitOfWork.Verify(s => s.Save(), Times.Never);
        }
Beispiel #2
0
        public void TestAngazovanjeServiceDelete()
        {
            var service  = new AngazovanjeService(unitOfWork.Object);
            var toDelete = unitOfWork.Object.AngazovanjeRepository.GetById(1, 1);

            service.Delete(toDelete);
            var result = unitOfWork.Object.AngazovanjeRepository.GetById(1, 1);
            var lista  = unitOfWork.Object.AngazovanjeRepository.GetAll();

            Assert.Null(result);
            Assert.DoesNotContain(lista, x => x.PasId == toDelete.PasId && x.ZadatakId == toDelete.ZadatakId);
            unitOfWork.Verify(s => s.AngazovanjeRepository.Delete(toDelete), Times.Once);
            unitOfWork.Verify(s => s.Save(), Times.Once);
        }