public void when_string_impulse_received_then_sets_system_state() { var stream = new EventStream(); var state = new SystemState(); var consumer = new SetSystemState(state); consumer.Connect(stream); Assert.False(state.Of<string>("t", "kids").Any()); stream.Push(Mock.Of<IDevice>(x => x.Id == "kids"), Impulse.Create("t", "foo", DateTimeOffset.Now)); Assert.Equal("foo", state.Of<string>("t", "kids").FirstOrDefault()); }
public void when_state_is_set_then_can_query() { var state = new SystemState(); var query = state.Of<float>("t", "kids").Where(v => v == 22f); Assert.False(query.Any()); state.Set("t", "kids", 22f); Assert.True(query.Any()); }