public void Should_Notify_Rx() { var data = CreateSampleData(); var store = new LiveStore <IPAddress>(() => { Thread.Sleep(TimeSpan.FromSeconds(1)); return(data); }); var notified = false; Thread.Sleep(TimeSpan.FromSeconds(2)); store.Updated.Subscribe(x => notified = true); Thread.Sleep(TimeSpan.FromSeconds(3)); var notified2 = false; store.Updated.Subscribe(x => notified2 = true); Assert.True(notified); Assert.True(notified2); }
public void Should_Be_Live() { var data = CreateSampleData(); var store = new LiveStore <IPAddress>(() => { Thread.Sleep(TimeSpan.FromSeconds(1)); return(data); }); Thread.Sleep(TimeSpan.FromSeconds(2)); Assert.NotEmpty(store); Assert.Equal(store.ElementAt(1), IPAddress.Parse("192.168.1.1")); }
public void Should_Notify() { var data = CreateSampleData(); var store = new LiveStore <IPAddress>(() => { Thread.Sleep(TimeSpan.FromSeconds(1)); return(data); }); var notified = false; Thread.Sleep(TimeSpan.FromSeconds(2)); store.UpdatedOldSchool += (s, a) => notified = true; Assert.True(notified); }