public void WhenPlantTreeCommand_ExpectFactoryPlantTreeCalled()
 {
     var value = 123;
     var treeController = new TreeController(_treeRepo.Object, _treeFactory.Object);
     treeController.PlantTree(new PlantTreeCommand() { Value = value});;
     _treeFactory.Verify(x=>x.PlantTree(value));
 }
 public void WhenPlantTreeCommand_ExpectRepositoryInsertCalled()
 {
     var value = 123;
     var tree = new Tree();
     var treeController = new TreeController(_treeRepo.Object, _treeFactory.Object);
     _treeFactory.Setup(x => x.PlantTree(value)).Returns(tree);
     treeController.PlantTree(new PlantTreeCommand() { Value = value }); ;
     _treeRepo.Verify(x=>x.Insert(tree));
 }
 public void WhenAddLeafCommand_ExpectAddLeafCalledOnTree()
 {
     var value = 321;
     var tree = new Mock<ITree>();
     _treeRepo.Setup(x => x.GetById(It.IsAny<Guid>())).Returns(tree.Object);
     var treeController = new TreeController(_treeRepo.Object, _treeFactory.Object);
     treeController.AddLeaf(new AddLeafCommand() { Value = value, TreeId = It.IsAny<Guid>()});
     tree.Verify(x=>x.AddLeaf(value));
 }
 public void WhenAddLeafCommandAndRepoDoesNotContainSpecifiedTree_ExpectException()
 {
     var value = 321;
     var treeController = new TreeController(_treeRepo.Object, _treeFactory.Object);
     treeController.AddLeaf(new AddLeafCommand() { Value = value, TreeId = It.IsAny<Guid>() });
 }