Beispiel #1
0
        public async Task UpdateAsync()
        {
            var oneHourElectricity = new OneHourElectricity
            {
                DateTime = DateTime.UtcNow,
                KiloWatt = 12312,
                PanelId  = 1
            };

            var insertResponse = await _repository.InsertAsync(oneHourElectricity);

            Assert.NotEqual(default(int), oneHourElectricity.Id);

            var result = await _repository.GetAsync(oneHourElectricity.Id);

            result.KiloWatt = 23;
            result.PanelId  = 2;

            await _repository.UpdateAsync(result);

            var updateResult = await _repository.GetAsync(result.Id);

            Assert.True(result.KiloWatt == 23);

            Assert.True(result.PanelId == 2);
        }
        public void UpdateAsync()
        {
            var sample = CreateRandomEntity(1);

            int res = _repository.InsertAsync(sample).Result;

            var result = _repository.GetAsync(sample.Id).Result;

            result.KiloWatt += 5000;

            _repository.UpdateAsync(result).Wait();

            var result2 = _repository.GetAsync(result.Id).Result;

            FullCompare(result, result2);
        }