Example #1
0
        public async Task UpdateHopAsync(HopDto hopDto)
        {
            var hop = Mapper.Map <HopDto, Hop>(hopDto);
            await _hopRepository.UpdateAsync(hop);

            var result = await _hopRepository.GetSingleAsync(hopDto.Id, "Flavours.Flavour", "Origin", "Substituts");

            var mappedResult = Mapper.Map <Hop, HopDto>(result);
            await _hopElasticsearch.UpdateAsync(mappedResult);
        }
Example #2
0
        public async Task UpdateHopAsync(HopDto hopDto)
        {
            var hop = AutoMapper.Mapper.Map <HopDto, Hop>(hopDto);
            await _hopRepository.UpdateAsync(hop);

            var result = await _hopRepository.GetSingleAsync(hopDto.Id);

            var mappedResult = AutoMapper.Mapper.Map <Hop, HopDto>(result);
            await _hopElasticsearch.UpdateAsync(mappedResult);

            await IndexBeerStylesAsync(hop);
        }
        public void UpdateHop_Oils_Get_Updated()
        {
            var hop = _hopRepository.GetSingleAsync(172).Result;

            hop.Purpose           = "Aroma";
            hop.Aliases           = "Test;test";
            hop.TotalOilHigh      = 2;
            hop.BPineneHigh       = 2;
            hop.LinaloolHigh      = 2;
            hop.MyrceneHigh       = 2;
            hop.CaryophylleneHigh = 2;
            hop.FarneseneHigh     = 2;
            hop.HumuleneHigh      = 2;
            hop.GeraniolHigh      = 2;
            hop.OtherOilHigh      = 2;
            hop.TotalOilLow       = 2;
            hop.BPineneLow        = 2;
            hop.LinaloolLow       = 2;
            hop.MyrceneLow        = 2;
            hop.CaryophylleneLow  = 2;
            hop.FarneseneLow      = 2;
            hop.HumuleneLow       = 2;
            hop.GeraniolLow       = 2;
            hop.OtherOilLow       = 2;
            hop.AromaWheel        = new List <HopFlavour>
            {
                new HopFlavour {
                    FlavourId = 1, HopId = hop.HopId
                },
            };
            hop.Flavours = new List <HopFlavour>
            {
                new HopFlavour {
                    FlavourId = 2, HopId = hop.HopId
                }
            };
            var result     = _hopRepository.UpdateAsync(hop).Result;
            var updatedHop = _hopRepository.GetSingleAsync(172).Result;

            Assert.AreEqual(hop.Purpose, updatedHop.Purpose);
            Assert.AreEqual(hop.Aliases, updatedHop.Aliases);
            Assert.AreEqual(hop.TotalOilHigh, updatedHop.TotalOilHigh);
            Assert.AreEqual(hop.BPineneHigh, updatedHop.BPineneHigh);
            Assert.AreEqual(hop.LinaloolHigh, updatedHop.LinaloolHigh);
            Assert.AreEqual(hop.MyrceneHigh, updatedHop.MyrceneHigh);
            Assert.AreEqual(hop.CaryophylleneHigh, updatedHop.CaryophylleneHigh);
            Assert.AreEqual(hop.FarneseneHigh, updatedHop.FarneseneHigh);
            Assert.AreEqual(hop.HumuleneHigh, updatedHop.HumuleneHigh);
            Assert.AreEqual(hop.GeraniolHigh, updatedHop.GeraniolHigh);
            Assert.AreEqual(hop.OtherOilHigh, updatedHop.OtherOilHigh);
            Assert.AreEqual(hop.TotalOilLow, updatedHop.TotalOilLow);
            Assert.AreEqual(hop.BPineneLow, updatedHop.BPineneLow);
            Assert.AreEqual(hop.LinaloolLow, updatedHop.LinaloolLow);
            Assert.AreEqual(hop.MyrceneLow, updatedHop.MyrceneLow);
            Assert.AreEqual(hop.CaryophylleneLow, updatedHop.CaryophylleneLow);
            Assert.AreEqual(hop.FarneseneLow, updatedHop.FarneseneLow);
            Assert.AreEqual(hop.HumuleneLow, updatedHop.HumuleneLow);
            Assert.AreEqual(hop.GeraniolLow, updatedHop.GeraniolLow);
            Assert.AreEqual(hop.OtherOilLow, updatedHop.OtherOilLow);
            Assert.NotNull(updatedHop);
        }