public void AddedWhenNoLongerInSecond() { Source1.Add(1); Source2.Add(1); Source2.Remove(1); _results.Data.Count.Should().Be(1); }
public void NothingFromOther() { _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source2.Add(1); _results.Data.Count.Should().Be(0); }
public void ExcludedWhenItemIsInOneSource() { _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source1.Add(1); Assert.AreEqual(0, _results.Data.Count); }
public void IncludedWhenItemIsInOneSource() { _source1.Add(1); Assert.AreEqual(1, _results.Data.Count); Assert.AreEqual(1, _results.Data.Items.First()); }
public void NothingFromOther() { _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source2.Add(1); Assert.AreEqual(0, _results.Data.Count); }
public void ExcludedWhenItemIsInOneSource() { _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source1.Add(1); _results.Data.Count.Should().Be(0); }
public void IncludedWhenItemIsInOneSource() { _source1.Add(1); _results.Data.Count.Should().Be(1); _results.Data.Items.First().Should().Be(1); }
public void AddedItemWillbeSubscribed() { _source.Add(new SubscribeableObject(1)); _results.Messages.Count.Should().Be(1, "Should be 1 updates"); _results.Data.Count.Should().Be(1, "Should be 1 item in the cache"); _results.Data.Items.First().IsSubscribed.Should().Be(true, "Should be subscribed"); }
public void NotIncludedWhenItemIsInTwoSources() { _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source1.Add(1); _source2.Add(1); _results.Data.Count.Should().Be(0); }
public void FiresAddWhenaNewItemIsAdded() { _source.Add(new Person("Person1", 20)); Assert.AreEqual(1, _results.Messages.Count, "Should be 1 updates"); Assert.AreEqual(1, _results.Data.Count, "Should be 1 item in the cache"); Assert.AreEqual(20, _results.Data.Items.First(), "Should 20"); }
public void FiresAddWhenaNewItemIsAdded() { _source.Add(new Person("Person1", 20)); _results.Messages.Count.Should().Be(1, "Should be 1 updates"); _results.Data.Count.Should().Be(1, "Should be 1 item in the cache"); _results.Data.Items.First().Should().Be(20, "Should 20"); }
public void AddedItemWillbeSubscribed() { _source.Add(new SubscribeableObject(1)); Assert.AreEqual(1, _results.Messages.Count, "Should be 1 updates"); Assert.AreEqual(1, _results.Data.Count, "Should be 1 item in the cache"); Assert.AreEqual(true, _results.Data.Items.First().IsSubscribed, "Should be subscribed"); }
public void IncludedWhenItemIsInTwoSources() { _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source1.Add(1); _source2.Add(1); Assert.AreEqual(1, _results.Data.Count); }
public void AddedWhenNoLongerInSecond() { _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source1.Add(1); _source2.Add(1); _source2.Remove(1); _results.Data.Count.Should().Be(1); }
public void Add() { var person = new Person("Adult1", 50); _source.Add(person); _results.Messages.Count.Should().Be(1, "Should be 1 updates"); _results.Data.Count.Should().Be(1, "Should be 1 item in the cache"); _results.Data.Items.First().Should().Be(_transformFactory(person), "Should be same person"); }
public IEventsDocument CreateEventsDocument(IEnumerable <IInstrumentedCall> calls) { var callsList = calls.ToArray(); var doc = new EventsDocument(this); doc.AddRange(callsList); doc.DocumentName = callsList.Length == 1 ? $"{callsList[0].CalledMethod} - events" : $"{callsList.Length} calls - events"; mDocuments.Add(doc); return(doc); }
public void AddInSucession() { _source.Add(1); _source.Add(2); _source.Add(3); _source.Add(4); _source.Add(5); CollectionAssert.AreEquivalent(new [] { 5, 4, 3, 2, 1 }, _results.Data.Items); }
public void ClearSource() { _source1.Add(0); _source2.Add(1); _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source.Clear(); _results.Data.Count.Should().Be(0); }
public void AddInSucession() { _source.Add(1); _source.Add(2); _source.Add(3); _source.Add(4); _source.Add(5); _results.Data.Items.ShouldAllBeEquivalentTo(new[] { 5, 4, 3, 2, 1 }); }
public void CanGroupOnAdds() { _source.Add(new Person("A", 10)); _results.Data.Count.Should().Be(1); var firstGroup = _results.Data.Items.First(); firstGroup.Count.Should().Be(1); firstGroup.Key.Should().Be(10); }
public void CanGroupOnAdds() { _source.Add(new Person("A", 10)); Assert.AreEqual(1, _results.Data.Count); var firstGroup = _results.Data.Items.First(); Assert.AreEqual(1, firstGroup.List.Count); Assert.AreEqual(10, firstGroup.GroupKey); }
public void AddLessThanLimit() { var person = _generator.Take(1).First(); _source.Add(person); _scheduler.AdvanceBy(TimeSpan.FromMilliseconds(150).Ticks); Assert.AreEqual(1, _results.Messages.Count, "Should be 1 updates"); Assert.AreEqual(1, _results.Data.Count, "Should be 1 item in the cache"); Assert.AreEqual(person, _results.Data.Items.First(), "Should be same person"); }
public void ChangeInvokedOnSubscriptionIfItHasData() { bool invoked = false; _source.Add(new Person("A", 1)); var subscription = _source.Connect() .QueryWhenChanged() .Subscribe(x => invoked = true); invoked.Should().BeTrue(); subscription.Dispose(); }
public void ChangeInvokedOnSubscriptionIfItHasData() { bool invoked = false; _source.Add(new Person("A", 1)); var subscription = _source.Connect() .QueryWhenChanged() .Subscribe(x => invoked = true); Assert.IsTrue(invoked, "Should have received on next"); subscription.Dispose(); }
public void NoResultsWillBeReceivedIfPaused() { _pausingSubject.OnNext(true); //advance otherwise nothing happens _scheduler.AdvanceBy(TimeSpan.FromMilliseconds(10).Ticks); _source.Add(new Person("A", 1)); //go forward an arbitary amount of time _scheduler.AdvanceBy(TimeSpan.FromMinutes(1).Ticks); _results.Messages.Count.Should().Be(0, "There should be no messages"); }
public void ItemIsReplaced() { _source1.Add(0); _source2.Add(1); _source.Add(_source1.Connect()); _source.Add(_source2.Connect()); _source1.ReplaceAt(0, 9); _results.Data.Count.Should().Be(2); _results.Messages.Count.Should().Be(3); _results.Data.Items.Should().BeEquivalentTo(9, 1); }
public void Add() { var person = new Person("Adult1", 50); _source.Add(person); Assert.AreEqual(1, _results.Messages.Count, "Should be 1 updates"); Assert.AreEqual(1, _results.Data.Count, "Should be 1 item in the cache"); var firstGroup = _results.Data.Items.First().List.Items.ToArray(); Assert.AreEqual(person, firstGroup[0], "Should be same person"); }
public async Task Add() { var person = new Person("Adult1", 50); _source.Add(person); Assert.AreEqual(1, _results.Messages.Count, "Should be 1 updates"); Assert.AreEqual(1, _results.Data.Count, "Should be 1 item in the cache"); var transformed = await _transformFactory(person); Assert.AreEqual(transformed, _results.Data.Items.First(), "Should be same person"); }
public void WillApplyTimeout() { _pausingSubject.OnNext(true); //should timeout _scheduler.AdvanceBy(TimeSpan.FromSeconds(61).Ticks); _source.Add(new Person("A", 1)); //go forward an arbitary amount of time // _scheduler.AdvanceBy(TimeSpan.FromMinutes(1).Ticks); _results.Messages.Count.Should().Be(1, "There should be no messages"); }
public void CanHandleAddsAndUpdates() { bool invoked = false; var subscription = _source.Connect().QueryWhenChanged(q => q.Count).Subscribe(query => invoked = true); var person = new Person("A", 1); _source.Add(person); _source.Remove(person); invoked.Should().BeTrue(); subscription.Dispose(); }