public void readFromDB() { cDB.updateBuffer("ciao", 72, DateTime.Now); ReadStatusCode s; var q = cDB.readValue((new string[] { "ciao" }), out s); Assert.Equal(1, q.Length); Assert.Equal(72, q[0].value); Assert.Equal(DateTime.Now.Second, q[0].timestamp.Second); Assert.Equal(ReadStatusCode.Ok, s); var p = cDB.readValue((new string[] { "ciao1" }), out s); Assert.Equal(0, p.Length); Assert.Equal(ReadStatusCode.VariableNotFoundInDB, s); }
public async void readFromDB() { cDB.updateBuffer("ciao", 72, DateTime.UtcNow, StatusCodes.Good); var q = await cDB.readValue((new string[] { "ciao" })); Assert.Single(q); Assert.Equal(72, q[0].value); Assert.Equal(DateTime.UtcNow.Second, q[0].timestamp.Second); Assert.True(q[0].success); Assert.Equal(StatusCodes.Good, q[0].statusCode); var p = await cDB.readValue((new string[] { "ciao1" })); Assert.Single(p); Assert.False(p[0].success); Assert.Equal(StatusCodes.BadNoEntryExists, p[0].statusCode); }