public void Remove(int id)
 {
     _service.Delete(id);
 }
 public string Delete(long id)
 {
     TreeService.Delete(id);
     return("OK");
 }
        public void TreeService_Delete_Calls_Repsoitory_Delete_Method_With_The_Same_Tree_Object_It_Recieved()
        {
            // Create test data
            var newTree = new Tree
            {
                Name = "Foo"
            };

            //Create Mock
            var mockRepository = new Mock<IRepository<Tree>>();
            _mockUnitOfWork.Setup(d => d.GetRepository<Tree>()).Returns(mockRepository.Object);

            //Arrange
            _service = new TreeService(_mockUnitOfWork.Object);

            //Act
            _service.Delete(newTree);

            //Assert
            mockRepository.Verify(r => r.Delete(newTree));
        }
        public void TreeService_Delete_Calls_UnitOfWork_Commit_Method()
        {
            // Create test data
            var newTree = new Tree
            {
                Name = "Foo"
            };

            //Create Mock
            var mockRepository = new Mock<IRepository<Tree>>();
            _mockUnitOfWork.Setup(d => d.GetRepository<Tree>()).Returns(mockRepository.Object);

            //Arrange
            _service = new TreeService(_mockUnitOfWork.Object);

            //Act
            _service.Delete(newTree);

            //Assert
            _mockUnitOfWork.Verify(d => d.Commit());
        }
        public void TreeService_Delete_Throws_On_Null_Tree()
        {
            //Arrange
            _service = new TreeService(_mockUnitOfWork.Object);

            //Assert
            Assert.Throws<ArgumentNullException>(() => _service.Delete(null));
        }