public async Task Plants_GetPlantByCommonName_ReturnsNull() { //Arrange var plantsInitialDBSet = _dbContextMock.CreateDbSetMock(x => x.Plant); var service = new PlantsServices(_dbContextMock.Object, _mapper); //Act var result = await service.GetPlantByCommonName(Moq.It.IsAny <string>()); //Assert Assert.Null(result); }
public async Task Plants_GetPlantByCommonName_ReturnsOk() { //Arrange var plantName = "Plant"; var plantsInitialDBSet = _dbContextMock.CreateDbSetMock(x => x.Plant, new[] { new Plant { CommonName = plantName } }); var service = new PlantsServices(_dbContextMock.Object, _mapper); //Act var result = await service.GetPlantByCommonName(plantName); //Assert Assert.NotNull(result); Assert.Equal(result.CommonName, plantName); }