public PlantControllerTest() { //Mock Setup plantMock = new Mock <ImyPlant>(); plantsMock = new List <ImyPlant> { plantMock.Object }; addPlantMock = new Mock <IAddPlant>(); updatePlantMock = new Mock <IUpdatePlant>(); mockRepo = new Mock <IRepoWrapper>(); plant = new myPlant(); plants = new List <myPlant>(); var allPlants = GetPlants(); //Sample Models addPlant = new AddPlant { ID = 1, Name = "Radish", DatePlanted = "29.10.2019", DateLastWatered = "30.10.2019", Garden = "Windowsill" }; updatePlant = new UpdatePlant { ID = 1, Name = "Radish", DatePlanted = "29.10.2019", DateLastWatered = "30.10.2019", Garden = "Windowsill" }; //Controller Setup var plantResultMock = new Mock <IActionResult>(); plantController = new PlantController(mockRepo.Object); }
public async void Execute() { var plant = TryDeserializePlant(); if (!string.IsNullOrEmpty(plant.DeviceId)) { var addPlantQuery = new AddPlant { Plant = _mapper.Map <Core.Models.Plant>(plant), Repository = _addPlantRepository }; await _mediator.Send(addPlantQuery); } }