예제 #1
0
        public void GetSingle_Not_Null_Not_Empty()
        {
            var yeast = _yeastRepository.GetSingle(1);

            Assert.NotNull(yeast);
            Assert.True(yeast.Name.Any());
        }
예제 #2
0
        protected override IList <YeastStepDto> ResolveCore(FermentationStep step)
        {
            var yeastStepDtoList = new List <YeastStepDto>();

            foreach (var item in step.Yeasts)
            {
                var yeastStepDto = new YeastStepDto()
                {
                    YeastId  = item.YeastId,
                    Amount   = item.Amount,
                    RecipeId = item.RecipeId,
                    Number   = item.StepNumber,
                };
                var yeast = _elasticsearch.GetSingle(item.YeastId);
                if (yeast == null)
                {
                    yeast = Mapper.Map <Yeast, YeastDto>(_yeastRepository.GetSingle(item.YeastId));
                }
                yeastStepDto.Name        = yeast.Name;
                yeastStepDto.Supplier    = yeast.Supplier;
                yeastStepDto.Type        = yeast.Type;
                yeastStepDto.ProductCode = yeast.ProductCode;

                yeastStepDtoList.Add(yeastStepDto);
            }
            return(yeastStepDtoList);
        }