Ejemplo n.º 1
0
        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);
            });
        }
Ejemplo n.º 2
0
        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);
            });
        }