public async Task Given_VibrationRepository_When_GettingAllVibrationRecords_Then_AllRecordsShouldBeReturnedAsync() { await RunOnDatabaseAsync(async sut => { //Arrange var repo = new VibrationRepository(sut); var record = new VibrationRecord { Id = Guid.NewGuid(), UserId = Guid.NewGuid(), Value = 10, Time = new DateTime(2017, 11, 20, 11, 21, 1) }; //Act await repo.AddAsync(record); await repo.SaveChangesAsync(); //Assert var results = await repo.GetAllAsync(); results.Count.Should().Be(1); }); }
public async Task Given_VibrationRepository_When_AddingAVibrationRecord_Then_TheRecordShouldBeMemorizedAsync() { await RunOnDatabaseAsync(async sut => { //Arrange var repo = new VibrationRepository(sut); var record = new VibrationRecord { Id = Guid.NewGuid(), UserId = Guid.NewGuid(), Value = 10, Time = new DateTime(2017, 11, 20, 11, 21, 1) }; //Act await repo.AddAsync(record); await repo.SaveChangesAsync(); //Assert var results = await repo.GetAllAsync(); results[0].ShouldBeEquivalentTo(record); }); }