public async void TestDelete() { ConnectionFactory connectionFactory = new ConnectionFactory(Environment.Testing); ISensorMeasurementDao sensorMeasurementDao = new SensorMeasurementDao(connectionFactory); SensorMeasurement sensorMeasurement = await InsertSensorMeasurement(connectionFactory); Assert.NotNull(await sensorMeasurementDao.FindById(sensorMeasurement.Id)); await sensorMeasurementDao.Delete(sensorMeasurement.Id); Assert.Null(await sensorMeasurementDao.FindById(sensorMeasurement.Id)); }
public async void TestFindById() { ConnectionFactory connectionFactory = new ConnectionFactory(Environment.Testing); ISensorMeasurementDao sensorMeasurementDao = new SensorMeasurementDao(connectionFactory); SensorMeasurement sensorMeasurement = await InsertSensorMeasurement(connectionFactory); SensorMeasurement sensorMeasurementFound = await sensorMeasurementDao.FindById(sensorMeasurement.Id); Assert.Equal(sensorMeasurement.Timestamp, sensorMeasurementFound.Timestamp); }
public async void TestUpdate() { ConnectionFactory connectionFactory = new ConnectionFactory(Environment.Testing); ISensorMeasurementDao sensorMeasurementDao = new SensorMeasurementDao(connectionFactory); SensorMeasurement sensorMeasurement = await InsertSensorMeasurement(connectionFactory); sensorMeasurement.Timestamp = 1576850015.2222; await sensorMeasurementDao.Update(sensorMeasurement); SensorMeasurement sensorMeasurementAfter = await sensorMeasurementDao.FindById(sensorMeasurement.Id); Assert.Equal(sensorMeasurement.Timestamp, sensorMeasurementAfter.Timestamp); }