public async Task ShouldUpdateRestingHeartRate() { var existingRestingHeartRate = new RestingHeartRate() { CreatedDate = new DateTime(2017, 1, 1), Beats = 1 }; _fakeLocalContext.RestingHeartRates.Add(existingRestingHeartRate); _fakeLocalContext.SaveChanges(); var newRestingHeartRates = new List <RestingHeartRate> { new RestingHeartRate() { CreatedDate = new DateTime(2017, 1, 1), Beats = 2 } }; await _healthRepository.UpsertAsync(newRestingHeartRates); Assert.Equal(2, existingRestingHeartRate.Beats); }
public void ShouldGetLatestRestingHeartRateDate() { var firstRestingHeartRate = new RestingHeartRate { CreatedDate = new DateTime(2018, 5, 1) }; var secondRestingHeartRate = new RestingHeartRate { CreatedDate = new DateTime(2018, 5, 2) }; var thirdRestingHeartRate = new RestingHeartRate { CreatedDate = new DateTime(2018, 5, 3) }; _fakeLocalContext.RestingHeartRates.Add(firstRestingHeartRate); _fakeLocalContext.RestingHeartRates.Add(secondRestingHeartRate); _fakeLocalContext.RestingHeartRates.Add(thirdRestingHeartRate); _fakeLocalContext.SaveChanges(); var latestRestingHeartRateDate = _healthRepository.GetLatestRestingHeartRateDate(); Assert.Equal(thirdRestingHeartRate.CreatedDate, latestRestingHeartRateDate); }