Ejemplo n.º 1
0
        public async Task Plants_GetPlantByID_ReturnsNull()
        {
            //Arrange
            var plantsInitialDBSet = _dbContextMock.CreateDbSetMock(x => x.Plant);
            var service            = new PlantsServices(_dbContextMock.Object, _mapper);

            //Act
            var result = await service.GetPlant(Moq.It.IsAny <Guid>());

            //Assert
            Assert.Null(result);
        }
Ejemplo n.º 2
0
        public async Task Plants_GetPlantByID_ReturnsOk()
        {
            //Arrange
            var plantID            = Guid.NewGuid();
            var plantsInitialDBSet = _dbContextMock.CreateDbSetMock(x => x.Plant, new[] { new Plant {
                                                                                              ID = plantID
                                                                                          } });
            var service = new PlantsServices(_dbContextMock.Object, _mapper);

            //Act
            var result = await service.GetPlant(plantID);

            //Assert
            Assert.NotNull(result);
            Assert.Equal(result.ID, plantID);
        }